Avoid updating resolv.conf when no changes have actually occured.

Submitted by:	ume
This commit is contained in:
Brooks Davis 2005-09-08 22:49:17 +00:00
parent 3d0181db3f
commit dd415a50d6

View File

@ -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.