From: deraadt Date: Mon, 16 Sep 1996 02:26:02 +0000 (+0000) Subject: _PATH_TMP -> _PATH_TMPFILE; avoid /tmp//fooXXXX where possible too X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=af50a896f49c67efef155950300d8b45a46822af;p=openbsd _PATH_TMP -> _PATH_TMPFILE; avoid /tmp//fooXXXX where possible too --- diff --git a/usr.bin/chpass/pathnames.h b/usr.bin/chpass/pathnames.h index 2e05e083960..395307b633b 100644 --- a/usr.bin/chpass/pathnames.h +++ b/usr.bin/chpass/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 1996/06/26 05:31:57 deraadt Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 1996/09/16 02:26:02 deraadt Exp $ */ /* $NetBSD: pathnames.h,v 1.3 1995/03/26 04:55:29 glass Exp $ */ /* @@ -38,5 +38,4 @@ #include -#undef _PATH_TMP -#define _PATH_TMP "/tmp/chpass.XXXXXX" +#define _PATH_TMPFILE "/tmp/chpass.XXXXXX" diff --git a/usr.bin/error/pathnames.h b/usr.bin/error/pathnames.h index f7e581e28ff..74170651395 100644 --- a/usr.bin/error/pathnames.h +++ b/usr.bin/error/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 1996/06/26 05:32:44 deraadt Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 1996/09/16 02:26:04 deraadt Exp $ */ /* $NetBSD: pathnames.h,v 1.3 1995/09/02 06:15:40 jtc Exp $ */ /* @@ -42,5 +42,4 @@ #define IG_FILE2 "llib-port" #define IG_FILE3 "/usr/lib/llib-lc" #define IG_FILE4 "/usr/lib/llib-port" -#undef _PATH_TMP -#define _PATH_TMP "/tmp/ErrorXXXXXX" +#define _PATH_TMPFILE "/tmp/ErrorXXXXXX" diff --git a/usr.bin/error/touch.c b/usr.bin/error/touch.c index d51cf06d2c0..42caf7d99e8 100644 --- a/usr.bin/error/touch.c +++ b/usr.bin/error/touch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: touch.c,v 1.4 1996/09/16 01:47:06 deraadt Exp $ */ +/* $OpenBSD: touch.c,v 1.5 1996/09/16 02:26:05 deraadt Exp $ */ /* $NetBSD: touch.c,v 1.3 1995/09/02 06:15:54 jtc Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: touch.c,v 1.4 1996/09/16 01:47:06 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: touch.c,v 1.5 1996/09/16 02:26:05 deraadt Exp $"; #endif /* not lint */ #include @@ -539,7 +539,7 @@ boolean edit(name) processname, name); return(TRUE); } - snprintf(n_name, sizeof n_name, "%s/error.XXXXXXXX", _PATH_TMP); + strcpy(n_name, _PATH_TMPFILE); if ((fd = mkstemp(n_name)) == -1 || (n_touchedfile = fdopen(fd, "w")) == NULL) { if (fd != -1) diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index 83d7511b8e4..7043c7155a7 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.3 1996/09/09 04:44:38 downsj Exp $ */ +/* $OpenBSD: cmds.c,v 1.4 1996/09/16 02:26:06 deraadt Exp $ */ /* $NetBSD: cmds.c,v 1.8 1995/09/08 01:06:05 tls Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94"; #else -static char rcsid[] = "$OpenBSD: cmds.c,v 1.3 1996/09/09 04:44:38 downsj Exp $"; +static char rcsid[] = "$OpenBSD: cmds.c,v 1.4 1996/09/16 02:26:06 deraadt Exp $"; #endif #endif /* not lint */ @@ -806,7 +806,7 @@ remglob(argv,doswitch) return (cp); } if (ftemp == NULL) { - (void) strcpy(temp, _PATH_TMP); + (void) strcpy(temp, _PATH_TMPFILE); (void) mktemp(temp); oldverbose = verbose, verbose = 0; oldhash = hash, hash = 0; diff --git a/usr.bin/ftp/pathnames.h b/usr.bin/ftp/pathnames.h index c3f18a19095..c3ffcbce4d2 100644 --- a/usr.bin/ftp/pathnames.h +++ b/usr.bin/ftp/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 1996/06/26 05:33:38 deraadt Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 1996/09/16 02:26:07 deraadt Exp $ */ /* $NetBSD: pathnames.h,v 1.5 1995/09/08 01:06:40 tls Exp $ */ /* @@ -38,5 +38,4 @@ #include -#undef _PATH_TMP -#define _PATH_TMP "/tmp/ftpXXXXXX" +#define _PATH_TMPFILE "/tmp/ftpXXXXXX" diff --git a/usr.bin/mail/main.c b/usr.bin/mail/main.c index 1e312217555..4ea11afbc50 100644 --- a/usr.bin/mail/main.c +++ b/usr.bin/mail/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.2 1996/06/11 12:53:45 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.3 1996/09/16 02:26:09 deraadt Exp $ */ /* $NetBSD: main.c,v 1.5 1996/06/08 19:48:31 christos Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.2 1996/06/11 12:53:45 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.3 1996/09/16 02:26:09 deraadt Exp $"; #endif #endif /* not lint */ @@ -113,6 +113,7 @@ main(argc, argv) /* * Next argument is person to pretend to be. */ + unsetenv("MAIL"); myname = optarg; break; case 'i': diff --git a/usr.bin/mail/temp.c b/usr.bin/mail/temp.c index 90373e0b091..53b3eb1d911 100644 --- a/usr.bin/mail/temp.c +++ b/usr.bin/mail/temp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: temp.c,v 1.2 1996/06/11 12:53:51 deraadt Exp $ */ +/* $OpenBSD: temp.c,v 1.3 1996/09/16 02:26:09 deraadt Exp $ */ /* $NetBSD: temp.c,v 1.5 1996/06/08 19:48:42 christos Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)temp.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: temp.c,v 1.2 1996/06/11 12:53:51 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: temp.c,v 1.3 1996/09/16 02:26:09 deraadt Exp $"; #endif #endif /* not lint */ @@ -68,11 +68,11 @@ tinit() tmpdir = _PATH_TMP; } - tempMail = tempnam (tmpdir, "Rs"); - tempResid = tempnam (tmpdir, "Rq"); - tempQuit = tempnam (tmpdir, "Rm"); - tempEdit = tempnam (tmpdir, "Re"); - tempMesg = tempnam (tmpdir, "Rx"); + tempMail = tempnam(tmpdir, "Rs"); + tempResid = tempnam(tmpdir, "Rq"); + tempQuit = tempnam(tmpdir, "Rm"); + tempEdit = tempnam(tmpdir, "Re"); + tempMesg = tempnam(tmpdir, "Rx"); /* * It's okay to call savestr in here because main will diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c index cc038f40284..35a2c9328cb 100644 --- a/usr.bin/man/man.c +++ b/usr.bin/man/man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man.c,v 1.3 1996/07/18 22:52:58 michaels Exp $ */ +/* $OpenBSD: man.c,v 1.4 1996/09/16 02:26:10 deraadt Exp $ */ /* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95"; #else -static char rcsid[] = "$OpenBSD: man.c,v 1.3 1996/07/18 22:52:58 michaels Exp $"; +static char rcsid[] = "$OpenBSD: man.c,v 1.4 1996/09/16 02:26:10 deraadt Exp $"; #endif #endif /* not lint */ @@ -501,7 +501,7 @@ build_page(fmt, pathp) TAG *intmpp; int fd, n; char *p, *b; - char buf[MAXPATHLEN], cmd[MAXPATHLEN], tpath[sizeof(_PATH_TMP)]; + char buf[MAXPATHLEN], cmd[MAXPATHLEN], tpath[MAXPATHLEN]; /* Let the user know this may take awhile. */ if (!warned) { @@ -543,7 +543,7 @@ build_page(fmt, pathp) * Get a temporary file and build a version of the file * to display. Replace the old file name with the new one. */ - (void)strcpy(tpath, _PATH_TMP); + (void)strcpy(tpath, _PATH_TMPFILE); if ((fd = mkstemp(tpath)) == -1) { warn("%s", tpath); (void)cleanup(); diff --git a/usr.bin/man/pathnames.h b/usr.bin/man/pathnames.h index 7c5799944e7..2ad3d1d95c8 100644 --- a/usr.bin/man/pathnames.h +++ b/usr.bin/man/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 1996/06/26 05:37:03 deraadt Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 1996/09/16 02:26:11 deraadt Exp $ */ /* $NetBSD: pathnames.h,v 1.3 1995/09/28 06:05:40 tls Exp $ */ /* @@ -38,5 +38,5 @@ #define _PATH_MANCONF "/etc/man.conf" #define _PATH_PAGER "/usr/bin/more -s" -#define _PATH_TMP "/tmp/man.XXXXXX" +#define _PATH_TMPFILE "/tmp/man.XXXXXX" #define _PATH_WHATIS "whatis.db" diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c index c718be557a1..d955a24cb00 100644 --- a/usr.bin/msgs/msgs.c +++ b/usr.bin/msgs/msgs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msgs.c,v 1.3 1996/06/26 05:37:18 deraadt Exp $ */ +/* $OpenBSD: msgs.c,v 1.4 1996/09/16 02:26:12 deraadt Exp $ */ /* $NetBSD: msgs.c,v 1.7 1995/09/28 06:57:40 tls Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: msgs.c,v 1.3 1996/06/26 05:37:18 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: msgs.c,v 1.4 1996/09/16 02:26:12 deraadt Exp $"; #endif #endif /* not lint */ @@ -764,7 +764,7 @@ char *prompt; strcpy(fname, "Messages"); } else { - strcpy(fname, _PATH_TMP); + strcpy(fname, _PATH_TMPFILE); mktemp(fname); sprintf(cmdbuf, _PATH_MAIL, fname); mailing = YES; diff --git a/usr.bin/msgs/pathnames.h b/usr.bin/msgs/pathnames.h index 74931bb7b7b..a3c7fed17d7 100644 --- a/usr.bin/msgs/pathnames.h +++ b/usr.bin/msgs/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 1996/06/26 05:37:18 deraadt Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 1996/09/16 02:26:13 deraadt Exp $ */ /* $NetBSD: pathnames.h,v 1.3 1995/09/28 06:57:41 tls Exp $ */ /* @@ -39,5 +39,4 @@ #define _PATH_MSGS "/var/msgs" #define _PATH_MAIL "/usr/bin/Mail -f %s" #define _PATH_PAGER "/usr/bin/more -%d" -#undef _PATH_TMP -#define _PATH_TMP "/tmp/msgXXXXXX" +#define _PATH_TMPFILE "/tmp/msgXXXXXX" diff --git a/usr.bin/rwall/rwall.c b/usr.bin/rwall/rwall.c index cf920021e62..c31cfdb5376 100644 --- a/usr.bin/rwall/rwall.c +++ b/usr.bin/rwall/rwall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rwall.c,v 1.2 1996/06/26 05:38:58 deraadt Exp $ */ +/* $OpenBSD: rwall.c,v 1.3 1996/09/16 02:26:14 deraadt Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -42,7 +42,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)wall.c 5.14 (Berkeley) 3/2/91";*/ -static char rcsid[] = "$OpenBSD: rwall.c,v 1.2 1996/06/26 05:38:58 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rwall.c,v 1.3 1996/09/16 02:26:14 deraadt Exp $"; #endif /* not lint */ /* @@ -127,7 +127,7 @@ makemsg(fname) char *whom, hostname[MAXHOSTNAMELEN], lbuf[100], tmpname[32]; (void)strcpy(tmpname, _PATH_TMP); - (void)strcat(tmpname, "/wall.XXXXXX"); + (void)strcat(tmpname, "wall.XXXXXX"); if (!(fd = mkstemp(tmpname)) || !(fp = fdopen(fd, "r+"))) { (void)fprintf(stderr, "wall: can't open temporary file.\n"); exit(1); diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c index b96980ce8e4..1878b2ac7b6 100644 --- a/usr.bin/wall/wall.c +++ b/usr.bin/wall/wall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wall.c,v 1.6 1996/09/02 09:07:35 deraadt Exp $ */ +/* $OpenBSD: wall.c,v 1.7 1996/09/16 02:26:18 deraadt Exp $ */ /* $NetBSD: wall.c,v 1.6 1994/11/17 07:17:58 jtc Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)wall.c 8.2 (Berkeley) 11/16/93"; #endif -static char rcsid[] = "$OpenBSD: wall.c,v 1.6 1996/09/02 09:07:35 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: wall.c,v 1.7 1996/09/16 02:26:18 deraadt Exp $"; #endif /* not lint */ /* @@ -190,7 +190,7 @@ makemsg(fname) char tmpbuf[5]; (void)strcpy(tmpname, _PATH_TMP); - (void)strcat(tmpname, "/wall.XXXXXX"); + (void)strcat(tmpname, "wall.XXXXXX"); if (!(fd = mkstemp(tmpname)) || !(fp = fdopen(fd, "r+"))) { (void)fprintf(stderr, "wall: can't open temporary file.\n"); exit(1); diff --git a/usr.bin/xstr/pathnames.h b/usr.bin/xstr/pathnames.h index 1561072a06e..a68f1d08d00 100644 --- a/usr.bin/xstr/pathnames.h +++ b/usr.bin/xstr/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.2 1996/06/26 05:44:33 deraadt Exp $ */ +/* $OpenBSD: pathnames.h,v 1.3 1996/09/16 02:26:20 deraadt Exp $ */ /* $NetBSD: pathnames.h,v 1.3 1994/11/14 04:56:22 jtc Exp $ */ /* @@ -34,7 +34,6 @@ * SUCH DAMAGE. * * @(#)pathnames.h 8.1 (Berkeley) 6/9/93 - * $NetBSD: pathnames.h,v 1.3 1994/11/14 04:56:22 jtc Exp $ */ -#define _PATH_TMP "/tmp/xstrXXXXXX" +#define _PATH_TMPFILE "/tmp/xstrXXXXXX" diff --git a/usr.bin/xstr/xstr.c b/usr.bin/xstr/xstr.c index a97f8d9c11b..7ba2a699eeb 100644 --- a/usr.bin/xstr/xstr.c +++ b/usr.bin/xstr/xstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xstr.c,v 1.2 1996/06/26 05:44:34 deraadt Exp $ */ +/* $OpenBSD: xstr.c,v 1.3 1996/09/16 02:26:20 deraadt Exp $ */ /* $NetBSD: xstr.c,v 1.5 1994/12/24 16:57:59 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)xstr.c 8.1 (Berkeley) 6/9/93"; #endif -static char rcsid[] = "$OpenBSD: xstr.c,v 1.2 1996/06/26 05:44:34 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: xstr.c,v 1.3 1996/09/16 02:26:20 deraadt Exp $"; #endif /* not lint */ #include @@ -116,7 +116,7 @@ main(argc, argv) if (cflg || argc == 0 && !readstd) inithash(); else - strings = mktemp(strdup(_PATH_TMP)); + strings = mktemp(strdup(_PATH_TMPFILE)); while (readstd || argc > 0) { if (freopen("x.c", "w", stdout) == NULL) perror("x.c"), exit(1);