-/* $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.
#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>
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <pwd.h>
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 */