From 2617d03a33a2e68a6ee6fed2278fcac6a3fb59b4 Mon Sep 17 00:00:00 2001 From: Victor Ananjevsky Date: Fri, 26 Jun 2015 23:03:11 +1000 Subject: sysctl: Correct stat on /etc/sysctl.conf sysctl --system fails when the file /etc/sysctl.conf doesn't exists. This happens due to wrong check of stat(2) return code. Reference: https://www.freelists.org/post/procps/sysctl Signed-off-by: Craig Small --- sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysctl.c') diff --git a/sysctl.c b/sysctl.c index dcf3a71..b19e2ee 100644 --- a/sysctl.c +++ b/sysctl.c @@ -655,7 +655,7 @@ static int PreloadSystem(void) } - if (stat(DEFAULT_PRELOAD, &ts) < 0 || S_ISREG(ts.st_mode)) { + if (stat(DEFAULT_PRELOAD, &ts) == 0 && S_ISREG(ts.st_mode)) { if (!Quiet) printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD); rc |= Preload(DEFAULT_PRELOAD); -- cgit v1.2.1