summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diff.c
diff options
context:
space:
mode:
authorsemarie <semarie@openbsd.org>2015-10-05 15:42:54 +0000
committersemarie <semarie@openbsd.org>2015-10-05 15:42:54 +0000
commitc31f148d21f4f20a5abf9da2bf779b4c411c42c1 (patch)
tree2ad5e84d3172b5f2c1507b24c6c3ddacf841911a /usr.bin/diff/diff.c
parentHandle ifi_oqdrops in netstat(8). (diff)
downloadwireguard-openbsd-c31f148d21f4f20a5abf9da2bf779b4c411c42c1.tar.xz
wireguard-openbsd-c31f148d21f4f20a5abf9da2bf779b4c411c42c1.zip
use different tame requests if TMPDIR is in env:
- tmppath for when mktemp() operates in /tmp proper - cpath+wpath for use of $TMPDIR based on log-message from previous commit ok deraadt@
Diffstat (limited to 'usr.bin/diff/diff.c')
-rw-r--r--usr.bin/diff/diff.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index 4b33cc6c40c..c7b47c98aa5 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.60 2015/10/05 15:16:23 deraadt Exp $ */
+/* $OpenBSD: diff.c,v 1.61 2015/10/05 15:42:54 semarie Exp $ */
/*
* Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -218,8 +218,13 @@ main(int argc, char **argv)
argv += optind;
if (lflag == 0) {
- if (tame("stdio wpath rpath cpath tmppath", NULL) == -1)
- err(1, "tame");
+ if (getenv("TMPDIR")) {
+ if (tame("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "tame");
+ } else {
+ if (tame("stdio rpath tmppath", NULL) == -1)
+ err(1, "tame");
+ }
}
/*
* Do sanity checks, fill in stb1 and stb2 and call the appropriate