Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/fwrite.c')
-rw-r--r--newlib/libc/stdio/fwrite.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c
index 642fb274f..1c91632b8 100644
--- a/newlib/libc/stdio/fwrite.c
+++ b/newlib/libc/stdio/fwrite.c
@@ -98,7 +98,12 @@ _DEFUN (fwrite, (buf, size, count, fp),
* generally slow and since this occurs whenever size==0.
*/
+ _flockfile(fp);
if (__sfvwrite (fp, &uio) == 0)
- return count;
+ {
+ _funlockfile(fp);
+ return count;
+ }
+ _funlockfile(fp);
return (n - uio.uio_resid) / size;
}