diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-11-05 18:31:36 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-11-05 18:31:36 +0100 |
commit | 41299df081a0a7edc646caf84d208145624a1d37 (patch) | |
tree | f2e7f07b5b2ea37fc42cbbef99636f6b84aabeb4 /winsup/cygwin/fcntl.cc | |
parent | eeef72702692fca52610634da32b56241e8083f3 (diff) | |
download | newlib-41299df081a0a7edc646caf84d208145624a1d37.zip newlib-41299df081a0a7edc646caf84d208145624a1d37.tar.gz newlib-41299df081a0a7edc646caf84d208145624a1d37.tar.bz2 |
Avoid deadlock in flock(2)
* fcntl.cc (fcntl64): Don't lock fd table when performing locking.
* flock.cc (flock): Ditto.
(lockf): Ditto.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/fcntl.cc')
-rw-r--r-- | winsup/cygwin/fcntl.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index babb064..cb97f68 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -1,7 +1,7 @@ /* fcntl.cc: fcntl syscall Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2008, 2009, - 2010, 2011, 2012, 2013, 2014 Red Hat, Inc. + 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc. This file is part of Cygwin. @@ -32,7 +32,9 @@ fcntl64 (int fd, int cmd, ...) { debug_printf ("fcntl(%d, %d, ...)", fd, cmd); - cygheap_fdget cfd (fd, true); + + /* Don't lock the fd table when performing locking calls. */ + cygheap_fdget cfd (fd, cmd < F_GETLK || cmd > F_SETLKW); if (cfd < 0) __leave; |