From: millert Date: Thu, 3 Apr 1997 05:31:37 +0000 (+0000) Subject: 10 X's for mktemp() and mkstemp(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=763196a6ed6f148e9225f99ffd8804a0ce192d19;p=openbsd 10 X's for mktemp() and mkstemp(). --- diff --git a/lib/libc/stdio/tempnam.c b/lib/libc/stdio/tempnam.c index d2060b0d18e..7c5f95e642d 100644 --- a/lib/libc/stdio/tempnam.c +++ b/lib/libc/stdio/tempnam.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: tempnam.c,v 1.8 1997/02/12 20:44:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: tempnam.c,v 1.9 1997/04/03 05:31:37 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -62,14 +62,14 @@ tempnam(dir, pfx) pfx = "tmp."; if (issetugid() == 0 && (f = getenv("TMPDIR"))) { - (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXXXXX", f, + (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXXXXXX", f, *(f + strlen(f) - 1) == '/'? "": "/", pfx); if (f = _mktemp(name)) return(f); } if (f = (char *)dir) { - (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXXXXX", f, + (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXXXXXX", f, *(f + strlen(f) - 1) == '/'? "": "/", pfx); if (f = _mktemp(name)) return(f); diff --git a/lib/libc/stdio/tmpfile.c b/lib/libc/stdio/tmpfile.c index 5f558efee99..265ed26b2d8 100644 --- a/lib/libc/stdio/tmpfile.c +++ b/lib/libc/stdio/tmpfile.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: tmpfile.c,v 1.3 1997/02/12 20:44:49 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: tmpfile.c,v 1.4 1997/04/03 05:31:38 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -52,7 +52,7 @@ tmpfile() sigset_t set, oset; FILE *fp; int fd, sverrno; -#define TRAILER "tmp.XXXXXXXXX" +#define TRAILER "tmp.XXXXXXXXXX" char buf[sizeof(_PATH_TMP) + sizeof(TRAILER)]; (void)memcpy(buf, _PATH_TMP, sizeof(_PATH_TMP) - 1); diff --git a/lib/libc/stdio/tmpnam.c b/lib/libc/stdio/tmpnam.c index 865800f3c12..d209e3c1c42 100644 --- a/lib/libc/stdio/tmpnam.c +++ b/lib/libc/stdio/tmpnam.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: tmpnam.c,v 1.5 1997/01/20 07:46:57 graichen Exp $"; +static char rcsid[] = "$OpenBSD: tmpnam.c,v 1.6 1997/04/03 05:31:38 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -57,7 +57,7 @@ tmpnam(s) if (s == NULL) s = buf; - (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXX", P_tmpdir, tmpcount); + (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXXXXX", P_tmpdir, tmpcount); ++tmpcount; return (_mktemp(s)); }