]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: more robust flock() usage
authorKarel Zak <kzak@redhat.com>
Tue, 8 Feb 2011 15:32:53 +0000 (16:32 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 8 Feb 2011 15:32:53 +0000 (16:32 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/mount/src/tab_update.c

index d66b64f940392adf9d754dd2a66aba301af38179..2084b5861c0ea9b8daa6b6bb7d8207f0cf3c4b35 100644 (file)
@@ -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;
        }