Cleanup of TMPDIR code.

Requested by:	bde (ages ago)
This commit is contained in:
Kris Kennaway 2000-08-03 23:44:43 +00:00
parent 7734ea0612
commit f8c5da6157

View File

@ -31,6 +31,7 @@ static const char rcsid[] =
#include <sys/types.h> #include <sys/types.h>
#include <err.h> #include <err.h>
#include <paths.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -64,13 +65,12 @@ main(int argc, char *argv[])
static char *fn[FN_CNT]; static char *fn[FN_CNT];
struct kgz_hdr kh; struct kgz_hdr kh;
const char *output; const char *output;
char *tmpdir;
int cflag, vflag, c; int cflag, vflag, c;
if (getenv("TMPDIR") == NULL) tmpdir = getenv("TMPDIR");
tname = strdup("/tmp/kgzXXXXXXXXXX"); if (asprintf(&tname, "%s/kgzXXXXXXXXXX", tmpdir == NULL ? _PATH_TMP : tmpdir) == -1)
else errx(1, "Out of memory");
if (asprintf(&tname, "%s/kgzXXXXXXXXXX", getenv("TMPDIR")) == -1)
errx(1, "Out of memory");
output = NULL; output = NULL;
cflag = vflag = 0; cflag = vflag = 0;