From: Felix Fietkau Date: Tue, 5 Feb 2008 02:25:54 +0000 (+0100) Subject: fix an off-by-one error that prevented the open() check from succeeding, if stdin... X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=commitdiff_plain;h=cba72526bbd55932caf58bcb673b8fa8b1b98c89;ds=sidebyside fix an off-by-one error that prevented the open() check from succeeding, if stdin is closed --- diff --git a/util.c b/util.c index 4713c74..bc137c3 100644 --- a/util.c +++ b/util.c @@ -396,7 +396,7 @@ static FILE *uci_open_stream(struct uci_context *ctx, const char *filename, int } fd = open(filename, mode, UCI_FILEMODE); - if (fd <= 0) + if (fd < 0) goto error; if (flock(fd, (write ? LOCK_EX : LOCK_SH)) < 0)