]> git.pld-linux.org Git - packages/procps.git/blame - procps-sysctl_stdin.patch
- massive attack s/pld.org.pl/pld-linux.org/
[packages/procps.git] / procps-sysctl_stdin.patch
CommitLineData
3a4a77c0 1--- procps-3.1.5/sysctl.c~ Thu Jan 16 11:43:14 2003
2+++ procps-3.1.5/sysctl.c Thu Jan 16 11:43:14 2003
3@@ -320,7 +320,13 @@
4 int n = 0;
5 int rc = 0;
6 char *name, *value;
7+ int reading_stdin = 0;
8
9+ if (filename && filename[0] == '-' && filename[1] == 0) {
10+ fp = stdin;
11+ reading_stdin = 1;
12+ }
13+ else
14 if (!filename || ((fp = fopen(filename, "r")) == NULL)) {
15 fprintf(stderr, ERR_PRELOAD_FILE, filename);
16 return -1;
17@@ -358,7 +364,9 @@
18 rc |= WriteSetting(buffer);
19 }
20
21- fclose(fp);
22+ if (!reading_stdin)
23+ fclose(fp);
24+
25 return rc;
26 }
27
28--- procps-3.1.5/sysctl.8~ Thu Jan 16 12:01:43 2003
29+++ procps-3.1.5/sysctl.8 Thu Jan 16 12:01:43 2003
30@@ -49,7 +49,8 @@
31 Use this option when you want to change a sysctl setting.
32 .TP
33 .B "-p"
34-Load in sysctl settings from the file specified or /etc/sysctl.conf if none given.
35+Load in sysctl settings from the file specified or /etc/sysctl.conf if none
36+given. Specifying "-" as filename means reading data from standard input.
37 .TP
38 .B "-a"
39 Display all values currently available.
This page took 0.05348 seconds and 4 git commands to generate.