diff options
author | Felix Fietkau <nbd@openwrt.org> | 2009-04-23 17:06:10 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2009-04-23 17:06:10 +0200 |
commit | 7840d049ef119fe2eb44c9f66f5af233c03f9d9c (patch) | |
tree | 2eefaa4c414bbdac7981845a4bc5f7f34bb9ed13 | |
parent | a315dd546791450a2ee00317938748947632d4f8 (diff) | |
download | uci-7840d049ef119fe2eb44c9f66f5af233c03f9d9c.tar.gz |
don't bail out on locking errors, when flock() is not supportedv0.7.5
-rw-r--r-- | util.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |