diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2007-03-23 03:30:53 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2007-03-23 03:30:53 +0000 |
commit | b33a3fa4ba853079fcee986220f59c6ab989ca99 (patch) | |
tree | d760df26bad92e98af51c7df894618872883a64a | |
parent | 30909f2d59ae675c576c7d283843cfa39c1ed76d (diff) |
Don't insert double slashes ("/tmp//p.XXXXXXXXXX") if TMPDIR ends
in "/". Helps emacs and deraadt@.
-rw-r--r-- | usr.bin/sendbug/sendbug.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c index c09ab513283..d1cfa12dbae 100644 --- a/usr.bin/sendbug/sendbug.c +++ b/usr.bin/sendbug/sendbug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sendbug.c,v 1.8 2007/03/23 03:19:30 ray Exp $ */ +/* $OpenBSD: sendbug.c,v 1.9 2007/03/23 03:30:52 ray Exp $ */ /* * Written by Ray Lai <ray@cyth.net>. @@ -79,7 +79,8 @@ main(int argc, char *argv[]) if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0') tmpdir = _PATH_TMP; - if (asprintf(&tmppath, "%s/p.XXXXXXXXXX", tmpdir) == -1) { + if (asprintf(&tmppath, "%s%sp.XXXXXXXXXX", tmpdir, + tmpdir[strlen(tmpdir) - 1] == '/' ? "" : "/") == -1) { warn("asprintf"); goto quit; } |