From 17655ab46c43623d49e0307cb042ea41c33bee8a Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 24 Dec 1996 20:00:04 +0000 Subject: [PATCH] use mkstemp instead --- usr.bin/ftp/cmds.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index a2ec1907f57..46706065ec0 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.7 1996/12/17 02:11:46 michaels Exp $ */ +/* $OpenBSD: cmds.c,v 1.8 1996/12/24 20:00:04 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.7 1996/12/17 02:11:46 michaels Exp $"; +static char rcsid[] = "$OpenBSD: cmds.c,v 1.8 1996/12/24 20:00:04 deraadt Exp $"; #endif #endif /* not lint */ @@ -808,18 +808,17 @@ remglob(argv,doswitch) return (cp); } if (ftemp == NULL) { + mode_t um; + (void) strcpy(temp, _PATH_TMPFILE); - (void) mktemp(temp); - /* create a zero-byte version of the file so that - * people can't play symlink games. - */ - fd = open (temp, O_CREAT | O_EXCL | O_WRONLY, 600); + um = umask(0600); + fd = mkstemp(temp); if (fd < 0) { - printf ("temporary file %s already exists\n",temp); - close (fd); + printf ("temporary file %s already exists\n", temp); return NULL; } - close (fd); + close (fd); + (void) umask(um); oldverbose = verbose, verbose = 0; oldhash = hash, hash = 0; if (doswitch) { -- 2.20.1