diff options
author | Brian Dessent <brian@dessent.net> | 2007-09-06 22:47:44 +0400 |
---|---|---|
committer | Brian Dessent <brian@dessent.net> | 2007-09-06 22:47:44 +0400 |
commit | 1eb76b8f84c8f718c98590caaebd5e38d206829a (patch) | |
tree | b89170332a7103377cd3b972a3a1e653f5a19208 /winsup | |
parent | b95701711b680a7edd863ba5fbb275af41cc506f (diff) |
* include/sys/stdio.h (_flockfile): Don't try to lock a FILE
that has the __SSTR flag set.
(_ftrylockfile): Likewise.
(_funlockfile): Likewise.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/stdio.h | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 5b7318ffc..c91abf2a0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2007-09-06 Brian Dessent <brian@dessent.net> + + * include/sys/stdio.h (_flockfile): Don't try to lock a FILE + that has the __SSTR flag set. + (_ftrylockfile): Likewise. + (_funlockfile): Likewise. + 2007-08-24 Corinna Vinschen <corinna@vinschen.de> * syscalls.cc (open): Don't follow symlinks if O_EXCL is given. diff --git a/winsup/cygwin/include/sys/stdio.h b/winsup/cygwin/include/sys/stdio.h index 7cc6f09f1..40b18b3be 100644 --- a/winsup/cygwin/include/sys/stdio.h +++ b/winsup/cygwin/include/sys/stdio.h @@ -14,15 +14,21 @@ details. */ #include <sys/cdefs.h> #include <sys/lock.h> +/* These definitions should be kept in sync with those in the newlib + header of the same name (newlib/libc/include/sys/stdio.h). */ + #if !defined(__SINGLE_THREAD__) # if !defined(_flockfile) -# define _flockfile(fp) __cygwin_lock_lock ((_LOCK_T *)&(fp)->_lock) +# define _flockfile(fp) ({ if (!((fp)->_flags & __SSTR)) \ + __cygwin_lock_lock ((_LOCK_T *)&(fp)->_lock); }) # endif # if !defined(_ftrylockfile) -# define _ftrylockfile(fp) __cygwin_lock_trylock ((_LOCK_T *)&(fp)->_lock) +# define _ftrylockfile(fp) (((fp)->_flags & __SSTR) ? 0 : \ + __cygwin_lock_trylock ((_LOCK_T *)&(fp)->_lock)) # endif # if !defined(_funlockfile) -# define _funlockfile(fp) __cygwin_lock_unlock ((_LOCK_T *)&(fp)->_lock) +# define _funlockfile(fp) ({ if (!((fp)->_flags & __SSTR)) \ + __cygwin_lock_unlock ((_LOCK_T *)&(fp)->_lock); }) # endif #endif |