When printing the interfaces resolv.conf we should preserve whitespace
authorRoy Marples <roy@marples.name>
Thu, 11 Aug 2011 09:18:16 +0000 (09:18 +0000)
committerRoy Marples <roy@marples.name>
Thu, 11 Aug 2011 09:18:16 +0000 (09:18 +0000)
on lines with information.

resolvconf.in

index e24a90b9cb655907e54b6d4742f45dd7d0dcd3f7..713c4a100814f8516d7ee1c09ac31a9df60ab543 100644 (file)
@@ -84,16 +84,23 @@ usage()
 
 echo_resolv()
 {
-       local line=
+       local line= OIFS="$IFS"
+
        [ -n "$1" -a -e "$IFACEDIR/$1" ] || return 1
        echo "# resolv.conf from $1"
        # Our variable maker works of the fact each resolv.conf per interface
        # is separated by blank lines.
        # So we remove them when echoing them.
        while read line; do
-               [ -n "$line" ] && echo "$line"
+               IFS="$OIFS"
+               if [ -n "$line" ]; then
+                       # We need to set IFS here to preserve any whitespace
+                       IFS=''
+                       printf "%s\n" "$line"
+               fi
        done < "$IFACEDIR/$1"
        echo
+       IFS="$OIFS"
 }
 
 # Parse resolv.conf's and make variables