From 29fd49dcdf9f5607e5d0380e463a21713c498160 Mon Sep 17 00:00:00 2001 From: brooks Date: Thu, 8 Sep 2005 22:49:17 +0000 Subject: [PATCH] Avoid updating resolv.conf when no changes have actually occured. Submitted by: ume --- sbin/dhclient/dhclient-script | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script index 75589d6f5cf9..fbf6e39a63b1 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.