summaryrefslogtreecommitdiffstats
path: root/usr.bin/sendbug/sendbug.c
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2007-03-23 03:30:52 +0000
committerray <ray@openbsd.org>2007-03-23 03:30:52 +0000
commit795a8b97fad0e61da0b945c2b4ed5526eec93685 (patch)
tree76c68a971130263da2cdc729cf040b4ec2c35975 /usr.bin/sendbug/sendbug.c
parentSupport command-line arguments in $EDITOR. Prodded by deraadt@. (diff)
downloadwireguard-openbsd-795a8b97fad0e61da0b945c2b4ed5526eec93685.tar.xz
wireguard-openbsd-795a8b97fad0e61da0b945c2b4ed5526eec93685.zip
Don't insert double slashes ("/tmp//p.XXXXXXXXXX") if TMPDIR ends
in "/". Helps emacs and deraadt@.
Diffstat (limited to 'usr.bin/sendbug/sendbug.c')
-rw-r--r--usr.bin/sendbug/sendbug.c5
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;
}