summaryrefslogtreecommitdiff
path: root/usr.bin/diff/diff.c
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2015-10-05 15:42:55 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2015-10-05 15:42:55 +0000
commit6eb8189de7f5a8ca3bb18a7dcc7dfcde960589dc (patch)
treed1e369bd0c7af8c0fe30c13be875749abb4d0aa7 /usr.bin/diff/diff.c
parent1dacec5562f4af2a244f9ebf9cf90fdcf32d202a (diff)
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