diff options
author | Karel Zak | 2011-02-08 16:32:53 +0100 |
---|---|---|
committer | Karel Zak | 2011-02-08 16:32:53 +0100 |
commit | 4b67533baa5f5f75ee1d1d3c61f42d38a4b4f219 (patch) | |
tree | c624ee37c2c8dc80fd2827670f9da4dc85775c88 /shlibs/mount/src/tab_update.c | |
parent | libuuid: fix locking of clock state counter file (diff) | |
download | kernel-qcow2-util-linux-4b67533baa5f5f75ee1d1d3c61f42d38a4b4f219.tar.gz kernel-qcow2-util-linux-4b67533baa5f5f75ee1d1d3c61f42d38a4b4f219.tar.xz kernel-qcow2-util-linux-4b67533baa5f5f75ee1d1d3c61f42d38a4b4f219.zip |
libmount: more robust flock() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/tab_update.c')
-rw-r--r-- | shlibs/mount/src/tab_update.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/shlibs/mount/src/tab_update.c b/shlibs/mount/src/tab_update.c index d66b64f94..2084b5861 100644 --- a/shlibs/mount/src/tab_update.c +++ b/shlibs/mount/src/tab_update.c @@ -616,8 +616,12 @@ static int utab_lock(const char *filename) if (fd < 0) return -errno; - if (flock(fd, LOCK_EX)) { - int errsv = errno; + + while (flock(fd, LOCK_EX) < 0) { + int errsv; + if ((errno == EAGAIN) || (errno == EINTR)) + continue; + errsv = errno; close(fd); return -errsv; } |