summaryrefslogtreecommitdiff
path: root/examples/udhcp
diff options
context:
space:
mode:
authorDenys Vlasenko2014-01-13 13:38:53 +0100
committerDenys Vlasenko2014-01-13 13:38:53 +0100
commit2e66daca654d130b820a4f0498de7f0ec355039a (patch)
treebbc54616cb4b0ed75205a1f812982cfe7f13cc30 /examples/udhcp
parentd74f8435ea7479fe558efa63c2ecc9aed5662db2 (diff)
downloadbusybox-2e66daca654d130b820a4f0498de7f0ec355039a.zip
busybox-2e66daca654d130b820a4f0498de7f0ec355039a.tar.gz
examples/udhcp: do not rewrite resolv.conf if no DNS servers. Closes 6788
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'examples/udhcp')
-rwxr-xr-xexamples/udhcp/sample.bound18
-rwxr-xr-xexamples/udhcp/sample.renew18
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