diff options
author | albert <> | 2006-06-24 21:17:51 +0000 |
---|---|---|
committer | albert <> | 2006-06-24 21:17:51 +0000 |
commit | a791f8034f1d70572c0f2cf13881078bebcb0643 (patch) | |
tree | 4f4bbb289ade2c5fbb3812d02f4df009087ad193 | |
parent | 47d33e7ed4e4d4f8a6910f796b776f9617a2e93a (diff) | |
download | procps-ng-a791f8034f1d70572c0f2cf13881078bebcb0643.tar.gz |
sysctl: use - for stdin
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | sysctl.8 | 1 | ||||
-rw-r--r-- | sysctl.c | 7 |
3 files changed, 9 insertions, 2 deletions
@@ -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 @@ -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. @@ -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; } |