diff options
author | Rob Landley <rob@landley.net> | 2015-02-11 17:10:28 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-02-11 17:10:28 -0600 |
commit | b2bb6e65f3461d1dfdcd3614c3c63f7a1453840b (patch) | |
tree | 991714b2113264347dd71ccbe3d042fc78bfc8fd /toys | |
parent | ca6a91063d241d48a5c83f9042ed370e3918b639 (diff) | |
download | toybox-b2bb6e65f3461d1dfdcd3614c3c63f7a1453840b.tar.gz |
Only apply mktemp directory to targets that aren't already paths.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/lsb/mktemp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/lsb/mktemp.c b/toys/lsb/mktemp.c index c80d84bb..f756ffe6 100644 --- a/toys/lsb/mktemp.c +++ b/toys/lsb/mktemp.c @@ -40,9 +40,9 @@ void mktemp_main(void) if (!TT.tmpdir) TT.tmpdir = getenv("TMPDIR"); if (!TT.tmpdir) TT.tmpdir = "/tmp"; - snprintf(toybuf, sizeof(toybuf), "%s/%s", TT.tmpdir, template); + if (!strchr(template, '/')) template = xmprintf("%s/%s", TT.tmpdir, template); - if (d_flag ? !mkdtemp(toybuf) : mkstemp(toybuf) == -1) { + if (d_flag ? !mkdtemp(template) : mkstemp(template) == -1) { if (toys.optflags & FLAG_q) toys.exitval = 1; else perror_exit("Failed to create %s %s/%s", d_flag ? "directory" : "file", TT.tmpdir, template); |