diff --git a/lib/libc/stdio/tmpfile.c b/lib/libc/stdio/tmpfile.c index 0c98ad3ee25..b38e0bca83b 100644 --- a/lib/libc/stdio/tmpfile.c +++ b/lib/libc/stdio/tmpfile.c @@ -61,7 +61,8 @@ tmpfile() char *buf; const char *tmpdir; - tmpdir = getenv("TMPDIR"); + if (issetugid() == 0) + tmpdir = getenv("TMPDIR"); if (tmpdir == NULL) tmpdir = _PATH_TMP;