summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2000-08-03 23:44:43 +0000
committerkris <kris@FreeBSD.org>2000-08-03 23:44:43 +0000
commit3da04b80dabe07351cb6872a8cfaf3236b7fcd4d (patch)
treec9a1391e3334881b00d778ae2061d02185687154
parentbe99417f31f7a677b27c7b8f2b86180311a38f0a (diff)
downloadFreeBSD-src-3da04b80dabe07351cb6872a8cfaf3236b7fcd4d.zip
FreeBSD-src-3da04b80dabe07351cb6872a8cfaf3236b7fcd4d.tar.gz
Cleanup of TMPDIR code.
Requested by: bde (ages ago)
-rw-r--r--usr.sbin/kgzip/kgzip.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/kgzip/kgzip.c b/usr.sbin/kgzip/kgzip.c
index d65476a8..3c3df36 100644
--- a/usr.sbin/kgzip/kgzip.c
+++ b/usr.sbin/kgzip/kgzip.c
@@ -31,6 +31,7 @@ static const char rcsid[] =
#include <sys/types.h>
#include <err.h>
+#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -64,13 +65,12 @@ main(int argc, char *argv[])
static char *fn[FN_CNT];
struct kgz_hdr kh;
const char *output;
+ char *tmpdir;
int cflag, vflag, c;
- if (getenv("TMPDIR") == NULL)
- tname = strdup("/tmp/kgzXXXXXXXXXX");
- else
- if (asprintf(&tname, "%s/kgzXXXXXXXXXX", getenv("TMPDIR")) == -1)
- errx(1, "Out of memory");
+ tmpdir = getenv("TMPDIR");
+ if (asprintf(&tname, "%s/kgzXXXXXXXXXX", tmpdir == NULL ? _PATH_TMP : tmpdir) == -1)
+ errx(1, "Out of memory");
output = NULL;
cflag = vflag = 0;
OpenPOWER on IntegriCloud