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:
authorJeff Johnston <jjohnstn@redhat.com>2009-04-25 02:52:52 +0400
committerJeff Johnston <jjohnstn@redhat.com>2009-04-25 02:52:52 +0400
commitbcde12940007e836f7b831f1cdfda8dc2bda0c58 (patch)
treed9894d46eb51edf603939d8506bf0b5f97b9fa87 /newlib/libc/stdio/fgetws.c
parent35f31b6a983710aa9a2bd7e308d1567f326f3f5f (diff)
2009-04-24 Jeff johnston <jjohnstn@redhat.com>
* libc/stdio/fgetc.c: Make sure sfp lock is acquired before the file lock and released before the file lock to avoid a deadlock scenario. * libc/stdio/fgets.c: Ditto. * libc/stdio/fgetwc.c: Ditto. * libc/stdio/fgetws.c: Ditto. * libc/stdio/fread.c: Ditto. * libc/stdio/fseek.c: Ditto. * libc/stdio/getc.c: Ditto. * libc/stdio/getdelim.c: Ditto. * libc/stdio/gets.c: Ditto.
Diffstat (limited to 'newlib/libc/stdio/fgetws.c')
-rw-r--r--newlib/libc/stdio/fgetws.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/newlib/libc/stdio/fgetws.c b/newlib/libc/stdio/fgetws.c
index 2784f1513..3dbae06cb 100644
--- a/newlib/libc/stdio/fgetws.c
+++ b/newlib/libc/stdio/fgetws.c
@@ -93,6 +93,7 @@ _DEFUN(_fgetws_r, (ptr, ws, n, fp),
const char *src;
unsigned char *nl;
+ __sfp_lock_acquire ();
_flockfile (fp);
ORIENT (fp, 1);
@@ -143,10 +144,12 @@ _DEFUN(_fgetws_r, (ptr, ws, n, fp),
goto error;
*wsp++ = L'\0';
_funlockfile (fp);
+ __sfp_lock_release ();
return ws;
error:
_funlockfile (fp);
+ __sfp_lock_release ();
return NULL;
}