summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-05 06:17:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-05 06:17:06 +0000
commit13fafbc15020d06ebb5f4849dc1fbbb4b14e91ae (patch)
tree704ba67632cbcaf96b9a48c2fcba93bbf1f2e6ec /usr.bin
parent0dac84f72104947be395f09f488d60dbb4b332a0 (diff)
tame "stdio rpath" is enough for the general case, which opens file
after file from argv. If it is discovered to be reading from stdin only, go to tame "stdio" ok doug
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/fmt/fmt.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index be4083ad80a..a5c95991355 100644
--- a/usr.bin/fmt/fmt.c
+++ b/usr.bin/fmt/fmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt.c,v 1.30 2013/11/26 13:18:55 deraadt Exp $ */
+/* $OpenBSD: fmt.c,v 1.31 2015/10/05 06:17:05 deraadt Exp $ */
/* Sensible version of fmt
*
@@ -255,6 +255,9 @@ main(int argc, char *argv[])
(void)setlocale(LC_CTYPE, "");
+ if (tame("stdio rpath", NULL) == -1)
+ err(1, "tame");
+
/* 1. Grok parameters. */
while ((ch = getopt(argc, argv, "0123456789cd:hl:mnpst:w:")) != -1) {
switch (ch) {
@@ -337,6 +340,8 @@ main(int argc, char *argv[])
while (argc-- > 0)
process_named_file(*argv++);
} else {
+ if (tame("stdio", NULL) != 0)
+ err(1, "tame");
process_stream(stdin, "standard input");
}