Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ypserv/ypinit use mktemp(1) as appropriate



details:   https://anonhg.NetBSD.org/src/rev/f255a47690fe
branches:  trunk
changeset: 511345:f255a47690fe
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Jun 18 11:21:54 2001 +0000

description:
use mktemp(1) as appropriate

diffstat:

 usr.sbin/ypserv/ypinit/ypinit.sh |  11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r 21cf9dadbc85 -r f255a47690fe usr.sbin/ypserv/ypinit/ypinit.sh
--- a/usr.sbin/ypserv/ypinit/ypinit.sh  Mon Jun 18 11:10:25 2001 +0000
+++ b/usr.sbin/ypserv/ypinit/ypinit.sh  Mon Jun 18 11:21:54 2001 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: ypinit.sh,v 1.8 1998/06/08 06:29:25 lukem Exp $
+#      $NetBSD: ypinit.sh,v 1.9 2001/06/18 11:21:54 lukem Exp $
 #
 # ypinit.sh - setup a master or slave YP server
 #
@@ -20,9 +20,8 @@
 
 progname=`basename $0`
 yp_dir=/var/yp
-tmpfile=/tmp/ypservers.$$
-
-trap 'rm -f ${tmpfile} ; exit 0' 0 2 3
+tmpfile=`mktemp /tmp/ypservers.XXXXXX` || exit 1
+trap "rm -f ${tmpfile} ; exit 0" EXIT INT QUIT
 
 umask 077                              # protect created directories
 
@@ -137,8 +136,7 @@
 
 done=
 while [ -z "${done}" ]; do
-       rm -f ${tmpfile}
-       touch ${tmpfile}
+       > ${tmpfile}
        cat <<__list_of_servers
 
 Please enter a list of YP servers, in order of preference.
@@ -189,7 +187,6 @@
 if [ -s ${tmpfile} ]; then
        ${INSTALL} -c -m 0444 ${tmpfile} ${binding_dir}/${domain}.ypservers
 fi
-rm -f ${tmpfile}
 
 if [ "${servertype}" = "client" ]; then
        exit 0



Home | Main Index | Thread Index | Old Index