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 <csmall@enc.com.au>
This commit is contained in:
Victor Ananjevsky 2015-06-26 23:03:11 +10:00 committed by Craig Small
parent 6a0850be7b
commit 2617d03a33

View File

@ -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);