aboutsummaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorWes Peters <wes@FreeBSD.org>2006-01-23 05:42:59 +0000
committerWes Peters <wes@FreeBSD.org>2006-01-23 05:42:59 +0000
commit90158aee27c7de9dcb2b5a2c74230676f38ddea7 (patch)
tree720b90b7a2daf92789388ef9cd17e74ec63c921f /sbin/dhclient
parentad4e4c676fb5f41902ebb0ace8c55bd23c3550e4 (diff)
Notes
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/dhclient-script19
1 files changed, 10 insertions, 9 deletions
diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script
index fd1fd61ef05a..9ba598c08188 100644
--- a/sbin/dhclient/dhclient-script
+++ b/sbin/dhclient/dhclient-script
@@ -135,21 +135,22 @@ add_new_resolv_conf() {
# thus broke the script. This code creates the resolv.conf if either
# are provided.
- rm -f /etc/resolv.conf.std
+ local tmpres=${TMPDIR:-/tmp}/resolv.conf.std
+ 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 @@ add_new_resolv_conf() {
# 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 @@ add_new_resolv_conf() {
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