[Midnightbsd-cvs] src: dhclient-script: Use /var/run instead of /etc for temp files.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Apr 10 20:39:27 EDT 2008


Log Message:
-----------
Use /var/run instead of /etc for temp files.

Modified Files:
--------------
    src/sbin/dhclient:
        dhclient-script (r1.1.1.2 -> r1.2)

-------------- next part --------------
Index: dhclient-script
===================================================================
RCS file: /home/cvs/src/sbin/dhclient/dhclient-script,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sbin/dhclient/dhclient-script -L sbin/dhclient/dhclient-script -u -r1.1.1.2 -r1.2
--- sbin/dhclient/dhclient-script
+++ sbin/dhclient/dhclient-script
@@ -135,21 +135,22 @@
 	# thus broke the script. This code creates the resolv.conf if either
 	# are provided.
 
-	rm -f /etc/resolv.conf.std
+	local tmpres=/var/run/resolv.conf.${interface}
+	rm -f $tmpres
 
 	if [ -n "$new_domain_name" ]; then
-		echo "search $new_domain_name" >>/etc/resolv.conf.std
+		echo "search $new_domain_name" >>$tmpres
 	fi
 
 	if [ -n "$new_domain_name_servers" ]; then
 		for nameserver in $new_domain_name_servers; do
-			echo "nameserver $nameserver" >>/etc/resolv.conf.std
+			echo "nameserver $nameserver" >>$tmpres
 		done
 	fi
 
-	if [ -f /etc/resolv.conf.std ]; then
+	if [ -f $tmpres ]; then
 		if [ -f /etc/resolv.conf.tail ]; then
-			cat /etc/resolv.conf.tail >>/etc/resolv.conf.std
+			cat /etc/resolv.conf.tail >>$tmpres
 		fi
 
 		# When resolv.conf is not changed actually, we don't
@@ -157,8 +158,8 @@
 		# If /usr is not mounted yet, we cannot use cmp, then
 		# the following test fails.  In such case, we simply
 		# ignore an error and do update resolv.conf.
-		if cmp -s /etc/resolv.conf.std /etc/resolv.conf; then
-			rm -f /etc/resolv.conf.std
+		if cmp -s $tmpres /etc/resolv.conf; then
+			rm -f $tmpres
 			return 0
 		fi 2>/dev/null
 
@@ -169,8 +170,8 @@
 		if [ -f /etc/resolv.conf ]; then
 			cat /etc/resolv.conf > /etc/resolv.conf.save
 		fi
-		cat /etc/resolv.conf.std > /etc/resolv.conf
-		rm -f /etc/resolv.conf.std
+		cat $tmpres > /etc/resolv.conf
+		rm -f $tmpres
 
 		# Try to ensure correct ownership and permissions.
 		chown -RL root:wheel /etc/resolv.conf
@@ -275,7 +276,7 @@
 	if [ -n "$new_routers" ]; then
 		$LOGGER "New Routers ($interface): $new_routers"
 		set "$new_routers"
-		if ping -q -c 1 -w 1 "$1"; then
+		if ping -q -c 1 -t 1 "$1"; then
 			if [ "$new_ip_address" != "$alias_ip_address" ]; then
 				add_new_alias
 			fi


More information about the Midnightbsd-cvs mailing list