From 2e66daca654d130b820a4f0498de7f0ec355039a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 13 Jan 2014 13:38:53 +0100 Subject: examples/udhcp: do not rewrite resolv.conf if no DNS servers. Closes 6788 Signed-off-by: Denys Vlasenko --- examples/udhcp/sample.bound | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'examples/udhcp/sample.bound') diff --git a/examples/udhcp/sample.bound b/examples/udhcp/sample.bound index bd3569c77..7c9d857e0 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 -- cgit v1.2.3