From: deraadt Date: Tue, 24 Dec 1996 19:28:03 +0000 (+0000) Subject: use mkstemp X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1a8d8787624906d1e840c9f34bd2a55188430792;p=openbsd use mkstemp --- 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 @@ -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 @@ -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 */