Check for TMPDIR and if set use it
This commit is contained in:
parent
a7b8eee6c0
commit
91a643411d
5
mktemp.c
5
mktemp.c
@ -19,7 +19,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *template = "tmp.XXXXXXXXXX";
|
||||
char *tmpdir = "/tmp";
|
||||
char *tmpdir = "/tmp", *p;
|
||||
char tmppath[PATH_MAX];
|
||||
int fd;
|
||||
|
||||
@ -39,6 +39,9 @@ main(int argc, char *argv[])
|
||||
else if (argc == 1)
|
||||
template = argv[0];
|
||||
|
||||
if ((p = getenv("TMPDIR")))
|
||||
tmpdir = p;
|
||||
|
||||
snprintf(tmppath, sizeof(tmppath), "%s/%s", tmpdir, template);
|
||||
if (dflag) {
|
||||
if (!mkdtemp(tmppath)) {
|
||||
|
Loading…
Reference in New Issue
Block a user