sysctl: use - for stdin
This commit is contained in:
parent
47d33e7ed4
commit
a791f8034f
3
NEWS
3
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
|
||||
|
||||
|
1
sysctl.8
1
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.
|
||||
|
7
sysctl.c
7
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user