[git commit] examples/udhcp: do not rewrite resolv.conf if no DNS servers. Closes 6788

Denys Vlasenko vda.linux at googlemail.com
Mon Jan 13 12:38:53 UTC 2014


commit: http://git.busybox.net/busybox/commit/?id=2e66daca654d130b820a4f0498de7f0ec355039a
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 examples/udhcp/sample.bound |   18 +++++++++++-------
 examples/udhcp/sample.renew |   18 +++++++++++-------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/examples/udhcp/sample.bound b/examples/udhcp/sample.bound
index bd3569c..7c9d857 100755
--- a/examples/udhcp/sample.bound
+++ b/examples/udhcp/sample.bound
@@ -22,10 +22,14 @@ then
 	done
 fi
 
-echo -n > $RESOLV_CONF
-[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
-for i in $dns
-do
-	echo adding dns $i
-	echo nameserver $i >> $RESOLV_CONF
-done
+# Only replace resolv.conf is we have at least one DNS server
+if [ -n "$dns" ]
+then
+	echo -n > $RESOLV_CONF
+	[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
+	for i in $dns
+	do
+		echo adding dns $i
+		echo nameserver $i >> $RESOLV_CONF
+	done
+fi
diff --git a/examples/udhcp/sample.renew b/examples/udhcp/sample.renew
index ea368fc..4dce848 100755
--- a/examples/udhcp/sample.renew
+++ b/examples/udhcp/sample.renew
@@ -22,10 +22,14 @@ then
 	done
 fi
 
-echo -n > $RESOLV_CONF
-[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
-for i in $dns
-do
-	echo adding dns $i
-	echo nameserver $i >> $RESOLV_CONF
-done
+# Only replace resolv.conf is we have at least one DNS server
+if [ -n "$dns" ]
+then
+	echo -n > $RESOLV_CONF
+	[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
+	for i in $dns
+	do
+		echo adding dns $i
+		echo nameserver $i >> $RESOLV_CONF
+	done
+fi


More information about the busybox-cvs mailing list