diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-05-30 08:58:42 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-05-30 08:58:42 +0000 |
commit | 4aa28d8ae279329f2b46c92e05b0bf457f07b9af (patch) | |
tree | ff4d1723c92ad0f708643f70125baf16e2beaf49 /newlib/libc/stdio/vfwscanf.c | |
parent | 75b6133098753a31b722f94b86e95b11323735f0 (diff) | |
download | cygnal-4aa28d8ae279329f2b46c92e05b0bf457f07b9af.tar.gz cygnal-4aa28d8ae279329f2b46c92e05b0bf457f07b9af.tar.bz2 cygnal-4aa28d8ae279329f2b46c92e05b0bf457f07b9af.zip |
* libc/stdio/local.h (_newlib_flockfile_start): New macro to
secure stream related critical section against thread cancellation.
(_newlib_flockfile_exit): Ditto.
(_newlib_sfp_lock_end): Ditto.
(_newlib_sfp_lock_start): Ditto for the list of streams.
(_newlib_sfp_lock_exit): Ditto.
(_newlib_sfp_lock_end): Ditto.
Use aforementioned macros in place of _flockfile/_funlockfile
and __sfp_lock_acquire/__sfp_lock_release throughout the code.
* libc/stdio/fclose.c: Explicitely disable and re-enable thread
cancellation. Explain why.
* libc/stdio/freopen.c: Ditto.
* libc/stdio64/freopen64.c: Ditto.
Diffstat (limited to 'newlib/libc/stdio/vfwscanf.c')
-rw-r--r-- | newlib/libc/stdio/vfwscanf.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 49ccf2f4b..5d2388df8 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -145,10 +145,12 @@ C99, POSIX-1.2008 #endif #ifdef STRING_ONLY -#undef _flockfile -#undef _funlockfile -#define _flockfile(x) {} -#define _funlockfile(x) {} +#undef _newlib_flockfile_start +#undef _newlib_flockfile_exit +#undef _newlib_flockfile_end +#define _newlib_flockfile_start(x) {} +#define _newlib_flockfile_exit(x) {} +#define _newlib_flockfile_end(x) {} #define _ungetwc_r _sungetwc_r #define __srefill_r __ssrefill_r #define _fgetwc_r _sfgetwc_r @@ -434,7 +436,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), # define GET_ARG(n, ap, type) (va_arg (ap, type)) #endif - _flockfile (fp); + _newlib_flockfile_start (fp); ORIENT (fp, 1); @@ -712,7 +714,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), * Disgusting backwards compatibility hacks. XXX */ case L'\0': /* compat */ - _funlockfile (fp); + _newlib_flockfile_exit (fp); return EOF; default: /* compat */ @@ -1440,12 +1442,12 @@ input_failure: should have been set prior to here. On EOF failure (including invalid format string), return EOF if no matches yet, else number of matches made prior to failure. */ - _funlockfile (fp); + _newlib_flockfile_exit (fp); return nassigned && !(fp->_flags & __SERR) ? nassigned : EOF; match_failure: all_done: /* Return number of matches, which can be 0 on match failure. */ - _funlockfile (fp); + _newlib_flockfile_end (fp); return nassigned; } |