diff --git a/NEWS b/NEWS index 665e277c..b3cd29a4 100644 --- a/NEWS +++ b/NEWS @@ -11,7 +11,8 @@ pwdx: buffer overflow fixed -- thanks Ulf Harnhammar procps.spec needed a slash -- thanks Jesse Brandeburg w: stale utmp entries snuck in via uninitialized var -- thanks Robert A Basch pgrep/pkill: fix some realloc-related crashes #353894 -pgrep/pkill: g is criteria (secret PLD Linux patch) +pgrep/pkill: g is criteria (PLD Linux, patch found in locked filing cabinet) +sysctl: use - for stdin (PLD Linux: beware of the leopard) procps-3.2.5 --> procps-3.2.6 diff --git a/sysctl.8 b/sysctl.8 index e8e44cf2..e26c4fba 100644 --- a/sysctl.8 +++ b/sysctl.8 @@ -57,6 +57,7 @@ Use this option when you want to change a sysctl setting. .TP .B "-p" Load in sysctl settings from the file specified or /etc/sysctl.conf if none given. +Specifying \- as filename means reading data from standard input. .TP .B "-a" Display all values currently available. diff --git a/sysctl.c b/sysctl.c index e25aeb91..0c0e73a6 100644 --- a/sysctl.c +++ b/sysctl.c @@ -365,7 +365,12 @@ static int Preload(const char *restrict const filename) { int rc = 0; char *name, *value; - if (!filename || ((fp = fopen(filename, "r")) == NULL)) { + fp = (filename[0]=='-' && !filename[1]) + ? stdin + : fopen(filename, "r") + ; + + if (!fp) { fprintf(stderr, ERR_PRELOAD_FILE, filename); return -1; }