X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=util.c;h=f0b2094810bcd8c75cb6097b62a76dbaabbc45da;hb=7840d049ef119fe2eb44c9f66f5af233c03f9d9c;hp=984305871ed306d4aee131b6a073f71c862c7f53;hpb=a315dd546791450a2ee00317938748947632d4f8;p=uci.git diff --git a/util.c b/util.c index 9843058..f0b2094 100644 --- a/util.c +++ b/util.c @@ -23,6 +23,7 @@ #include #include #include +#include #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);