From 27218ecb9a9c16dd965e29139e15f9b6e419a774 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 19 Apr 1997 20:53:47 +0000 Subject: use mkstemp --- usr.bin/tn3270/sys_curses/system.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'usr.bin/tn3270/sys_curses') diff --git a/usr.bin/tn3270/sys_curses/system.c b/usr.bin/tn3270/sys_curses/system.c index 46668849160..429a52a9d19 100644 --- a/usr.bin/tn3270/sys_curses/system.c +++ b/usr.bin/tn3270/sys_curses/system.c @@ -1,4 +1,4 @@ -/* $OpenBSD: system.c,v 1.4 1997/04/04 18:41:33 deraadt Exp $ */ +/* $OpenBSD: system.c,v 1.5 1997/04/19 20:53:46 deraadt Exp $ */ /*- * Copyright (c) 1988 The Regents of the University of California. @@ -35,7 +35,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)system.c 4.5 (Berkeley) 4/26/91";*/ -static char rcsid[] = "$OpenBSD: system.c,v 1.4 1997/04/04 18:41:33 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: system.c,v 1.5 1997/04/19 20:53:46 deraadt Exp $"; #endif /* not lint */ #include @@ -63,6 +63,7 @@ extern int errno; #include #include #include +#include #include #include @@ -637,20 +638,14 @@ char *argv[]; int fd; struct timeval tv; long ikey; - extern long random(); - extern char *mktemp(); - extern char *strcpy(); - /* First, create verification file. */ - do { - keyname = mktemp(strdup("/tmp/apiXXXXXXXXXX")); - fd = open(keyname, O_RDWR|O_CREAT|O_EXCL, IREAD|IWRITE); - } while ((fd == -1) && (errno == EEXIST)); - - if (fd == -1) { + keyname = strdup("/tmp/apiXXXXXXXXXX"); + if ((fd = mkstemp(keyname)) == -1) { perror("open"); + free(keyname); return 0; } + keyname = strdup(sockNAME); /* Now, get seed for random */ -- cgit v1.2.3