Do not increase size in _fgets if we reach the EOF.
This commit is contained in:
1 parent
dbe24395f4
commit
5fae797e41
1 file changed
+4
-1
+4
-1
@@ -552,8 +552,11 @@ string_fgets(string_t v, FILE *f, string_fgets_t arg)
|
||||
}
|
||||
STRING_CONTRACT(v);
|
||||
return;
|
||||
} else if (p == NULL)
|
||||
} else if (p == NULL && !feof(f)) {
|
||||
/* The string buffer is not big enough:
|
||||
increase it and continue reading */
|
||||
stringi_fit2size (v, v->alloc + v->alloc/2);
|
||||
}
|
||||
}
|
||||
STRING_CONTRACT (v);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user