]> git.ipfire.org Git - thirdparty/util-linux.git/commit
flock: make flock(1) work on NFSv4
authorPetr Uzel <petr.uzel@suse.cz>
Thu, 15 Sep 2011 08:19:17 +0000 (10:19 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Sep 2011 13:02:44 +0000 (15:02 +0200)
commit87d83b6ad2e52a3c867fe2f758e4eccaea145a10
tree8070b155cb22cffecba1338048e18f383e7bbd73
parent716e6f5c9a2fcbd549191a00962abb59cf15ca20
flock: make flock(1) work on NFSv4

To pleace an exclusive lock on a file, NFSv4 requires
the file to be opened RW because of the emulation of flock()
by fcntl():

http://www.spinics.net/lists/linux-nfs/msg18502.html

So instead of O_RDONLY, open the file in O_RDWR if access()
indicates it is possible (unless shared lock is requested).

From: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
sys-utils/flock.c