When checking for binary file, check if ch is not EOF only ch actually got
a value assigned Reported by: pfg
This commit is contained in:
parent
24be79982e
commit
47bc90320f
@ -514,12 +514,14 @@ istextfile(FILE *f)
|
||||
if (f == NULL)
|
||||
return (1);
|
||||
rewind(f);
|
||||
for (i = 0; i <= MAX_CHECK || ch != EOF; i++) {
|
||||
for (i = 0; i <= MAX_CHECK; i++) {
|
||||
ch = fgetc(f);
|
||||
if (ch == '\0') {
|
||||
rewind(f);
|
||||
return (0);
|
||||
}
|
||||
if (ch == EOF)
|
||||
break;
|
||||
}
|
||||
rewind(f);
|
||||
return (1);
|
||||
|
Loading…
Reference in New Issue
Block a user