diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-19 20:53:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-19 20:53:47 +0000 |
commit | 27218ecb9a9c16dd965e29139e15f9b6e419a774 (patch) | |
tree | aac522d5364db8dd934ba8efcfa76fbb1003df5d /usr.bin/tn3270/sys_curses | |
parent | 48d0ded9bf14420f7d5789c3fbd4d136d2332036 (diff) |
use mkstemp
Diffstat (limited to 'usr.bin/tn3270/sys_curses')
-rw-r--r-- | usr.bin/tn3270/sys_curses/system.c | 19 |
1 files changed, 7 insertions, 12 deletions
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 <sys/types.h> @@ -63,6 +63,7 @@ extern int errno; #include <netdb.h> #include <signal.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <pwd.h> @@ -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 */ |