summaryrefslogtreecommitdiff
path: root/sysctl.c
diff options
context:
space:
mode:
authoralbert <>2006-06-24 21:17:51 +0000
committeralbert <>2006-06-24 21:17:51 +0000
commita791f8034f1d70572c0f2cf13881078bebcb0643 (patch)
tree4f4bbb289ade2c5fbb3812d02f4df009087ad193 /sysctl.c
parent47d33e7ed4e4d4f8a6910f796b776f9617a2e93a (diff)
downloadprocps-ng-a791f8034f1d70572c0f2cf13881078bebcb0643.tar.gz
sysctl: use - for stdin
Diffstat (limited to 'sysctl.c')
-rw-r--r--sysctl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sysctl.c b/sysctl.c
index e25aeb9..0c0e73a 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;
}