about summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
Diffstat (limited to 'libio')
-rw-r--r--libio/fmemopen.c2
-rw-r--r--libio/iofopncook.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index 7c8769a130..b847f62c9a 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -127,7 +127,7 @@ fmemopen_write (void *cookie, const char *b, size_t s)
       if ((size_t) (c->pos + addnullc) == c->size)
 	{
 	  __set_errno (ENOSPC);
-	  return -1;
+	  return 0;
 	}
       s = c->size - c->pos - addnullc;
     }
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