sysctl --system ignores missing /etc/sysctl.conf
sysctl --system would not correctly return the RC for files in subdirectories and would insist on having /etc/sysctl.conf This update makes two changes when using sysctl --system: - The RC status is ORed for each config file, meaning an error in any file is propated to the RC - If /etc/sysctl.conf doesn't exist we just don't load it References: https://bbs.archlinux.org/viewtopic.php?id=170005 http://www.freelists.org/post/procps/wrong-defaults-for-sysctl-on-arch-linux
This commit is contained in:
parent
4141efaf13
commit
cdca71e945
10
sysctl.c
10
sysctl.c
@ -578,6 +578,8 @@ static int PreloadSystem(void)
|
||||
};
|
||||
struct pair **cfgs = NULL;
|
||||
unsigned ncfgs = 0;
|
||||
int rc = 0;
|
||||
struct stat ts;
|
||||
enum { nprealloc = 16 };
|
||||
|
||||
for (di = 0; di < sizeof(dirs) / sizeof(dirs[0]); ++di) {
|
||||
@ -634,12 +636,16 @@ static int PreloadSystem(void)
|
||||
for (i = 0; i < ncfgs; ++i) {
|
||||
if (!Quiet)
|
||||
printf(_("* Applying %s ...\n"), cfgs[i]->value);
|
||||
Preload(cfgs[i]->value);
|
||||
rc |= Preload(cfgs[i]->value);
|
||||
}
|
||||
|
||||
|
||||
if (stat(DEFAULT_PRELOAD, &ts) < 0 && S_ISREG(ts.st_mode)) {
|
||||
if (!Quiet)
|
||||
printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD);
|
||||
return Preload(DEFAULT_PRELOAD);
|
||||
rc |= Preload(DEFAULT_PRELOAD);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user