summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-24 19:28:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-24 19:28:04 +0000
commitc06e39168de379418a42ed5ab6fdacf64507f55f (patch)
treed8a5c7005047fc35d3c0478519b08ea9d29d80ca
parent38904db10f60818ca8e843c9e584e561329277c7 (diff)
use mkstemp
-rw-r--r--usr.sbin/ypserv/ypxfr/ypxfr.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/usr.sbin/ypserv/ypxfr/ypxfr.c b/usr.sbin/ypserv/ypxfr/ypxfr.c
index 33a83373ff8..7bf5665adef 100644
--- a/usr.sbin/ypserv/ypxfr/ypxfr.c
+++ b/usr.sbin/ypserv/ypxfr/ypxfr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypxfr.c,v 1.9 1996/10/01 01:53:08 deraadt Exp $ */
+/* $OpenBSD: ypxfr.c,v 1.10 1996/12/24 19:28:03 deraadt Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
@@ -32,7 +32,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: ypxfr.c,v 1.9 1996/10/01 01:53:08 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ypxfr.c,v 1.10 1996/12/24 19:28:03 deraadt Exp $";
#endif
#include <stdio.h>
@@ -571,12 +571,19 @@ char *argv[];
}
if (status == YPPUSH_SUCC) {
+ int fd;
/* Create temporary db */
- mktemp(mapname);
- db = create_db(domain,map,mapname);
- if(db == NULL) {
+ fd = mkstemp(mapname);
+ if (fd == -1)
status = YPPUSH_DBM;
+ else
+ close(fd);
+
+ if (status > 0) {
+ db = create_db(domain,map,mapname);
+ if(db == NULL)
+ status = YPPUSH_DBM;
}
/* Add ORDER */