Message ID | DUB122-W26CBD521F3D280AA7ED975E4F30@phx.gbl |
---|---|
State | New |
Headers | show |
--- input.c.jj 2013-01-10 21:38:27.000000000 +0100 +++ input.c 2013-11-07 15:33:53.804990865 +0100 @@ -106,12 +106,15 @@ read_line (FILE *file) { size_t len = strlen (string + pos); - if (string[pos + len - 1] == '\n') + if (len && string[pos + len - 1] == '\n') { string[pos + len - 1] = 0; return string; } pos += len; + /* test if binary file or last line incomplete? */ + if (pos < string_len-1) + return pos && feof (file) ? string : NULL; string = XRESIZEVEC (char, string, string_len * 2); string_len *= 2; }