From 3f1db94aaaf5a9020581c1d43c0d7660cfd74207 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 28 Jan 2008 03:44:28 +0100 Subject: [PATCH] add an extra check --- file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.11.0