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
};
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) {
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 (!Quiet)
- printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD);
- return Preload(DEFAULT_PRELOAD);
+
+ if (stat(DEFAULT_PRELOAD, &ts) < 0 && S_ISREG(ts.st_mode)) {
+ if (!Quiet)
+ printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD);
+ rc |= Preload(DEFAULT_PRELOAD);
+ }
+ return rc;
}
/*