[procps] sysctl

  • From: Victor Ananjevsky <ananasik@xxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Thu, 25 Jun 2015 17:00:15 +0300


hi

sysctl --system fails when the file /etc/sysctl.conf doesn't exists.
this happens due to wrong check of stat(2) return code

here is a quick fix of this bug

--- procps-3.3.10/sysctl.c.orig 2014-09-23 14:40:36.000000000 +0300
+++ procps-3.3.10/sysctl.c 2014-12-10 16:36:29.543190911 +0200
@@ -655,7 +655,7 @@
}


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



--
Victor Ananjevsky <ananasik@xxxxxxxxx>

Other related posts: