diff options
Diffstat (limited to 'newlib/libc/stdio/fvwrite.c')
-rw-r--r-- | newlib/libc/stdio/fvwrite.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index 21167c7..0d91aa2 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -60,7 +60,7 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio), return 0; /* make sure we can write */ - if (cantwrite (fp)) + if (cantwrite (ptr, fp)) { fp->_flags |= __SERR; ptr->_errno = EBADF; @@ -147,6 +147,8 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio), { /* Free buffer which is no longer used. */ _free_r (ptr, fp->_bf._base); + /* Ensure correct errno, even if free changed it. */ + ptr->_errno = ENOMEM; goto err; } fp->_bf._base = str; |