From: Felix Fietkau Date: Mon, 28 Jan 2008 02:44:28 +0000 (+0100) Subject: add an extra check X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=commitdiff_plain;h=3f1db94aaaf5a9020581c1d43c0d7660cfd74207;hp=7e840cf19ac6c867b9708257efd93e4a7efaa97e add an extra check --- diff --git a/file.c b/file.c index 6eaa5ec..4650a96 100644 --- 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);