diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2003-06-13 12:08:44 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2003-06-13 12:08:44 +0000 |
commit | 104129fc7e73b74c78139953c4e3843a2093f263 (patch) | |
tree | 110a1204a7640b52d8e4e62dbeb82675269f8057 /usr.sbin/dhcp/dhclient | |
parent | 3487950a0fa8d38ec1e0f8f2d4c4f698836e6a75 (diff) |
Be more careful with resolv.conf. It may be a link (e.g. during
installs) so just pour new information into the existing file/link
rather than removing and replacing it.
Noticed by and fix tested by Jan Johansson.
Several enhancements suggested as a result and in the pipeline.
ok deraadt@ millert@
Diffstat (limited to 'usr.sbin/dhcp/dhclient')
-rw-r--r-- | usr.sbin/dhcp/dhclient/scripts/dhclient-script | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/dhcp/dhclient/scripts/dhclient-script b/usr.sbin/dhcp/dhclient/scripts/dhclient-script index 5c5d1395f05..984867cd68a 100644 --- a/usr.sbin/dhcp/dhclient/scripts/dhclient-script +++ b/usr.sbin/dhcp/dhclient/scripts/dhclient-script @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: dhclient-script,v 1.12 2003/06/10 23:38:17 krw Exp $ +# $OpenBSD: dhclient-script,v 1.13 2003/06/13 12:08:43 krw Exp $ # # @@ -97,8 +97,12 @@ add_new_resolv_conf() { cat /etc/resolv.conf.tail >>/etc/resolv.conf.std fi - rm -f /etc/resolv.conf - mv /etc/resolv.conf.std /etc/resolv.conf + # In case (e.g. during OpenBSD installs) /etc/resolv.conf + # is a symbolic link, take care to preserve the link and write + # the new data in the correct location. + + cat /etc/resolv.conf.std > /etc/resolv.conf + rm -f /etc/resolv.conf.std return 0 fi |