mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 09:10:28 +00:00
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
eacd600ea9
commit
da5c2c4230
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298851
|
@ -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 a new issue