[TSAN] Fix infinite loop on targets where char is unsigned
For targets where char is unsigned (like PowerPC), something like
char c = fgetc(...) will never produce a char that will compare
equal to EOF so this loop does not terminate.
Change the type to int (which appears to be the POSIX return type
This allows the test case to terminate normally on PPC.