From bcde12940007e836f7b831f1cdfda8dc2bda0c58 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 24 Apr 2009 22:52:52 +0000 Subject: 2009-04-24 Jeff johnston * 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. --- newlib/libc/stdio/fgetc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'newlib/libc/stdio/fgetc.c') diff --git a/newlib/libc/stdio/fgetc.c b/newlib/libc/stdio/fgetc.c index e275cfeeb..9837a2ebc 100644 --- a/newlib/libc/stdio/fgetc.c +++ b/newlib/libc/stdio/fgetc.c @@ -93,9 +93,11 @@ _DEFUN(fgetc, (fp), #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) int result; CHECK_INIT(_REENT, fp); + __sfp_lock_acquire (); _flockfile (fp); result = __sgetc_r (_REENT, fp); _funlockfile (fp); + __sfp_lock_release (); return result; #else return _fgetc_r (_REENT, fp); -- cgit v1.2.3