summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2000-08-23 08:51:46 +0000
committerKris Kennaway <kris@FreeBSD.org>2000-08-23 08:51:46 +0000
commita1fb9483fb811aea192933d2937b6c19931f599b (patch)
treed28c88aaa6366601c9b5010094a818aeb16a5a01
parent16ef9820b980458cc935bc016904ad857a8b83f6 (diff)
Notes
-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 d65476a82770..3c3df367426d 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;