summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient/dhclient-script
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2005-09-08 22:49:17 +0000
committerbrooks <brooks@FreeBSD.org>2005-09-08 22:49:17 +0000
commit29fd49dcdf9f5607e5d0380e463a21713c498160 (patch)
tree77a20b866064afc50f37ed36112e5f58af5c13ed /sbin/dhclient/dhclient-script
parent4384a744062b95c7fb4dff0bd7e9031c5db8e631 (diff)
downloadFreeBSD-src-29fd49dcdf9f5607e5d0380e463a21713c498160.zip
FreeBSD-src-29fd49dcdf9f5607e5d0380e463a21713c498160.tar.gz
Avoid updating resolv.conf when no changes have actually occured.
Submitted by: ume
Diffstat (limited to 'sbin/dhclient/dhclient-script')
-rw-r--r--sbin/dhclient/dhclient-script10
1 files changed, 10 insertions, 0 deletions
diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script
index 75589d6..fbf6e39 100644
--- a/sbin/dhclient/dhclient-script
+++ b/sbin/dhclient/dhclient-script
@@ -151,6 +151,16 @@ add_new_resolv_conf() {
cat /etc/resolv.conf.tail >>/etc/resolv.conf.std
fi
+ # When resolv.conf is not changed actually, we don't
+ # need to update it.
+ # 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
+ return 0
+ fi 2>/dev/null
+
# 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.
OpenPOWER on IntegriCloud