summaryrefslogtreecommitdiffstats
path: root/usr.bin/sendbug/sendbug.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2009-08-26 20:40:40 +0000
committerderaadt <deraadt@openbsd.org>2009-08-26 20:40:40 +0000
commitf89edd4b64c4c903e10c4f73e6cd7da5b55ace97 (patch)
treebbe7758f824cca54fa91a947cbd88d1d2040a5a3 /usr.bin/sendbug/sendbug.c
parentmore bloody const crap mk broke (diff)
downloadwireguard-openbsd-f89edd4b64c4c903e10c4f73e6cd7da5b55ace97.tar.xz
wireguard-openbsd-f89edd4b64c4c903e10c4f73e6cd7da5b55ace97.zip
initialize tmpdir before use; PR 6214
Diffstat (limited to 'usr.bin/sendbug/sendbug.c')
-rw-r--r--usr.bin/sendbug/sendbug.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c
index 160c8d04559..aaba5133c5c 100644
--- a/usr.bin/sendbug/sendbug.c
+++ b/usr.bin/sendbug/sendbug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sendbug.c,v 1.62 2009/06/07 15:36:45 ray Exp $ */
+/* $OpenBSD: sendbug.c,v 1.63 2009/08/26 20:40:40 deraadt Exp $ */
/*
* Written by Ray Lai <ray@cyth.net>.
@@ -109,14 +109,15 @@ main(int argc, char *argv[])
if (argc > 0)
usage();
+ if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
+ tmpdir = _PATH_TMP;
+
if (Pflag) {
init();
template(stdout);
exit(0);
}
- if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
- tmpdir = _PATH_TMP;
if (asprintf(&tmppath, "%s%sp.XXXXXXXXXX", tmpdir,
tmpdir[strlen(tmpdir) - 1] == '/' ? "" : "/") == -1)
err(1, "asprintf");