summaryrefslogtreecommitdiff
path: root/libio/iofopncook.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-09-23 16:36:09 +0000
committerUlrich Drepper <drepper@redhat.com>2005-09-23 16:36:09 +0000
commit32053042d4785ffeae3a032808480c8dc2f98607 (patch)
treebfa6fb199b0f47051f624eb2d93778e54fcd2989 /libio/iofopncook.c
parent997470b3e151845b067b0a7c865f9ab7177d14c1 (diff)
[BZ #394]
2005-09-23 Ulrich Drepper <drepper@redhat.com> [BZ #394] * libio/fmemopen.c (fmemopen_write): Return 0 instead of -1 if nothing can be written. * libio/iofopncook.c (_IO_cookie_write): If something went wrong, set error bit.
Diffstat (limited to 'libio/iofopncook.c')
-rw-r--r--libio/iofopncook.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index 9c5503d1f2..976ff5093a 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -64,9 +64,16 @@ _IO_cookie_write (fp, buf, size)
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
if (cfile->__io_functions.write == NULL)
- return -1;
+ {
+ fp->_flags |= _IO_ERR_SEEN;
+ return 0;
+ }
+
+ _IO_ssize_t n = cfile->__io_functions.write (cfile->__cookie, buf, size);
+ if (n < size)
+ fp->_flags |= _IO_ERR_SEEN;
- return cfile->__io_functions.write (cfile->__cookie, buf, size);
+ return n;
}
static _IO_off64_t