]> sourceware.org Git - newlib-cygwin.git/commitdiff
* include/sys/stdio.h (_flockfile): Don't try to lock a FILE
authorBrian Dessent <brian@dessent.net>
Thu, 6 Sep 2007 18:47:44 +0000 (18:47 +0000)
committerBrian Dessent <brian@dessent.net>
Thu, 6 Sep 2007 18:47:44 +0000 (18:47 +0000)
that has the __SSTR flag set.
(_ftrylockfile): Likewise.
(_funlockfile): Likewise.

winsup/cygwin/ChangeLog
winsup/cygwin/include/sys/stdio.h

index 5b7318ffc14eeb5786ead5a20c953042c24bc0f8..c91abf2a0f1aa1c091dd2dfa161db06964d536eb 100644 (file)
@@ -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.
index 7cc6f09f1560691f41998dc2251dbe3bee93e7b1..40b18b3be2cc8056d8f44e188fd0fe07ba42acc6 100644 (file)
@@ -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
 
This page took 0.042503 seconds and 5 git commands to generate.