From c31f148d21f4f20a5abf9da2bf779b4c411c42c1 Mon Sep 17 00:00:00 2001 From: semarie Date: Mon, 5 Oct 2015 15:42:54 +0000 Subject: 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@ --- usr.bin/diff/diff.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'usr.bin/diff/diff.c') 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 @@ -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 -- cgit v1.2.3-59-g8ed1b