From: deraadt Date: Sat, 19 Apr 1997 20:53:46 +0000 (+0000) Subject: use mkstemp X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=622df7ccf2e298a9fae0f0e98253bb36fd6821e2;p=openbsd use mkstemp --- 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 */