diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2012-11-28 00:59:27 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2012-11-28 01:00:50 +0530 |
commit | de2fd463b1c0310d75084b6d774fb974075a4ad9 (patch) | |
tree | d51bae43dd28baf8aa9dd591e5195bd938f89482 /libio/iofwrite_u.c | |
parent | c515fb5148f1d81d5f7736825e14c7502c15432a (diff) | |
download | glibc-de2fd463b1c0310d75084b6d774fb974075a4ad9.zip glibc-de2fd463b1c0310d75084b6d774fb974075a4ad9.tar.gz glibc-de2fd463b1c0310d75084b6d774fb974075a4ad9.tar.bz2 |
Make fwrite return 0 on EOF
Diffstat (limited to 'libio/iofwrite_u.c')
-rw-r--r-- | libio/iofwrite_u.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libio/iofwrite_u.c b/libio/iofwrite_u.c index a1077ee..245a93e 100644 --- a/libio/iofwrite_u.c +++ b/libio/iofwrite_u.c @@ -44,12 +44,12 @@ fwrite_unlocked (buf, size, count, fp) if (_IO_fwide (fp, -1) == -1) { written = _IO_sputn (fp, (const char *) buf, request); - /* We have written all of the input in case the return value indicates - this or EOF is returned. The latter is a special case where we - simply did not manage to flush the buffer. But the data is in the - buffer and therefore written as far as fwrite is concerned. */ - if (written == request || written == EOF) + /* We are guaranteed to have written all of the input, none of it, or + some of it. */ + if (written == request) return count; + else if (written == EOF) + return 0; } return written / size; |