]> pilppa.com Git - uci.git/commitdiff
don't bail out on locking errors, when flock() is not supported
authorFelix Fietkau <nbd@openwrt.org>
Thu, 23 Apr 2009 15:06:10 +0000 (17:06 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 23 Apr 2009 15:06:10 +0000 (17:06 +0200)
util.c

diff --git a/util.c b/util.c
index 984305871ed306d4aee131b6a073f71c862c7f53..f0b2094810bcd8c75cb6097b62a76dbaabbc45da 100644 (file)
--- a/util.c
+++ b/util.c
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <ctype.h>
 #include <fcntl.h>
+#include <errno.h>
 
 #define LINEBUF        32
 #define LINEBUF_MAX    4096
@@ -453,7 +454,8 @@ static FILE *uci_open_stream(struct uci_context *ctx, const char *filename, int
        if (fd < 0)
                goto error;
 
-       if (flock(fd, (write ? LOCK_EX : LOCK_SH)) < 0)
+       ret = flock(fd, (write ? LOCK_EX : LOCK_SH));
+       if ((ret < 0) && (errno != ENOSYS))
                goto error;
 
        ret = lseek(fd, 0, pos);