diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-11-29 09:33:31 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-11-29 09:33:31 +0000 |
commit | 0ab9348b020703a81ffe37420418fb9e6117e47b (patch) | |
tree | 01b03fc4826235735b287f59b1db7608e183990e /mailbox | |
parent | 1d95c0ddbb712a575604e8a398402c6ca2073ea2 (diff) | |
download | mailutils-0ab9348b020703a81ffe37420418fb9e6117e47b.tar.gz mailutils-0ab9348b020703a81ffe37420418fb9e6117e47b.tar.bz2 |
(_stdin_file_read): Test for eof condition.
Diffstat (limited to 'mailbox')
-rw-r--r-- | mailbox/file_stream.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mailbox/file_stream.c b/mailbox/file_stream.c index fe6ce57ae..b432fd74e 100644 --- a/mailbox/file_stream.c +++ b/mailbox/file_stream.c @@ -177,7 +177,7 @@ static int _stdin_file_read (stream_t stream, char *optr, size_t osize, off_t offset, size_t *pnbytes) { - int status; + int status = 0; size_t nbytes; struct _file_stream *fs = stream_get_owner (stream); int fs_offset = fs->offset; @@ -212,6 +212,11 @@ _stdin_file_read (stream_t stream, char *optr, size_t osize, if (status) return status; } + + if (feof (fs->file)) + nbytes = 0; + else + { status = _file_read (stream, optr, osize, fs_offset, &nbytes); if (status == 0 && nbytes) { @@ -222,6 +227,7 @@ _stdin_file_read (stream_t stream, char *optr, size_t osize, return status; if (k != nbytes) return EIO; + } } if (pnbytes) *pnbytes = nbytes; |