]> pilppa.com Git - uci.git/commitdiff
add an extra check
authorFelix Fietkau <nbd@openwrt.org>
Mon, 28 Jan 2008 02:44:28 +0000 (03:44 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 28 Jan 2008 02:44:28 +0000 (03:44 +0100)
file.c

diff --git a/file.c b/file.c
index 6eaa5ecb3589be5b3393d34f55417655bd50f2c3..4650a96cec17a300e84e2e271d43f75fe7339843 100644 (file)
--- a/file.c
+++ b/file.c
@@ -567,7 +567,9 @@ int uci_load(struct uci_context *ctx, const char *name, struct uci_package **pac
        if (fd <= 0)
                UCI_THROW(ctx, UCI_ERR_IO);
 
-       flock(fd, LOCK_SH);
+       if (flock(fd, LOCK_SH) < 0)
+               UCI_THROW(ctx, UCI_ERR_IO);
+
        file = fdopen(fd, "r");
        if (!file)
                UCI_THROW(ctx, UCI_ERR_IO);