summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diff.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-10-05 15:16:23 +0000
committerderaadt <deraadt@openbsd.org>2015-10-05 15:16:23 +0000
commit6c036d4aa576416de7808e27a519c1c28aabb984 (patch)
treeae37e570ea85df3020911f303337c25ac3d1a9f6 /usr.bin/diff/diff.c
parentcorrect a rtget() error check (diff)
downloadwireguard-openbsd-6c036d4aa576416de7808e27a519c1c28aabb984.tar.xz
wireguard-openbsd-6c036d4aa576416de7808e27a519c1c28aabb984.zip
If the -l flag is set, diff will fork/execve pr on a pipe. But other
uses can tame "stdio wpath rpath cpath tmppath". tmppath for when mktemp() operates in /tmp proper, but cpath+wpath for use of $TMPDIR. ok sthen millert
Diffstat (limited to 'usr.bin/diff/diff.c')
-rw-r--r--usr.bin/diff/diff.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index 743e9332f36..4b33cc6c40c 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.59 2015/04/29 04:00:25 deraadt Exp $ */
+/* $OpenBSD: diff.c,v 1.60 2015/10/05 15:16:23 deraadt Exp $ */
/*
* Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -217,6 +217,10 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
+ if (lflag == 0) {
+ if (tame("stdio wpath rpath cpath tmppath", NULL) == -1)
+ err(1, "tame");
+ }
/*
* Do sanity checks, fill in stb1 and stb2 and call the appropriate
* driver routine. Both drivers use the contents of stb1 and stb2.