mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-21 18:27:22 +00:00
mktemp: skip later TMPDIR check if -p is specified
We already did the necessary $TMPDIR fallback, if it's going to be used.
Skip the later check so that we don't accidentally override our -p
argument.
Fixes: ac6f924e1c
("mktemp: add -p/--tmpdir argument")
Sponsored by: Klara, Inc.
This commit is contained in:
parent
83286682f8
commit
d22f03636b
|
@ -85,6 +85,12 @@ main(int argc, char **argv)
|
|||
tmpdir = optarg;
|
||||
if (tmpdir == NULL || *tmpdir == '\0')
|
||||
tmpdir = getenv("TMPDIR");
|
||||
|
||||
/*
|
||||
* We've already done the necessary environment
|
||||
* fallback, skip the later one.
|
||||
*/
|
||||
prefer_tmpdir = false;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
|
|
|
@ -69,7 +69,7 @@ tmpdir_pflag_body()
|
|||
# Finally, combined -p -t
|
||||
atf_check -o match:"^$pflag/foo\..+$" \
|
||||
env -u TMPDIR mktemp -p "$pflag" -t foo
|
||||
atf_check -o match:"^$tmpdir/foo\..+$" \
|
||||
atf_check -o match:"^$pflag/foo\..+$" \
|
||||
env TMPDIR="$tmpdir" mktemp -p "$pflag" -t foo
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue