mirror of
https://github.com/intel/llvm.git
synced 2026-01-28 09:14:23 +08:00
[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 for fgetc). This allows the test case to terminate normally on PPC.
This commit is contained in:
@@ -13,7 +13,7 @@ long count_memory_mappings() {
|
||||
|
||||
FILE *proc_file = fopen(proc_file_name, "r");
|
||||
long line_count = 0;
|
||||
char c;
|
||||
int c;
|
||||
do {
|
||||
c = fgetc(proc_file);
|
||||
if (c == '\n') {
|
||||
|
||||
Reference in New Issue
Block a user