Discussion:
[gs-code-review] Bug 690152, Regression: Input from stdin on OS X
Alex Cherepanov
2008-12-31 20:00:15 UTC
Permalink
Continue to access the stream while reading a string (sgets()) until the
string is filled, EOF is reached, or an error occurs. Don't return after
first partial read.

Old code did the same thing for 1-byte reads. This handling is now
extended to the reads of any size.

No differences was found in the testing against 'comparefiles' and CET
suite.
-------------- next part --------------
Index: gs/base/stream.c
===================================================================
--- gs/base/stream.c (revision 9301)
+++ gs/base/stream.c (working copy)
@@ -535,7 +535,7 @@
*/
s->srptr = s->srlimit = s->cbuf - 1;
s->position += cw.ptr - wptr;
- if (status != 1 || cw.ptr == cw.limit)
+ if (status <= 0 || cw.ptr == cw.limit)
break;
}
c = spgetc(s);

Loading...