prevent (harmless) error messages to show up
authorNicolas Thill <nico@openwrt.org>
Sun, 26 Mar 2006 22:54:12 +0000 (22:54 +0000)
committerNicolas Thill <nico@openwrt.org>
Sun, 26 Mar 2006 22:54:12 +0000 (22:54 +0000)
SVN-Revision: 3503

openwrt/package/base-files/default/etc/functions.sh
openwrt/package/base-files/default/etc/preinit
openwrt/package/base-files/default/sbin/ifdown
openwrt/package/base-files/default/usr/share/udhcpc/default.script

index 54b0a906c131b26b77b0a33b0a50678128c1c27d..d9ffc722f781d884d3be01b91d307e00609c0fd0 100755 (executable)
@@ -61,9 +61,9 @@ do_ifup() {
                DHCP_HOSTNAME=${DHCP_HOSTNAME%%.*}
                [ -z $DHCP_HOSTNAME ] || DHCP_ARGS="$DHCP_ARGS -H $DHCP_HOSTNAME"
                [ "$if_proto" = "pptp" ] && DHCP_ARGS="$DHCP_ARGS -n -q" || DHCP_ARGS="$DHCP_ARGS -R &"
-               oldpid=$(cat $pidfile)
+               [ -r $pidfile ] && oldpid=$(cat $pidfile 2>&-)
                ${DEBUG:-eval} "udhcpc $DHCP_ARGS"
-               pidof udhcpc | grep "$oldpid" >&- 2>&- && {
+               [ -n "$oldpid" ] && pidof udhcpc | grep "$oldpid" >&- 2>&- && {
                        sleep 1
                        kill -9 $oldpid
                }
index 4b57799d0c5ffba85c36b63b0b307e1b6e757781..04454f8a95621c4dda928a08f31c028003cc57dd 100755 (executable)
@@ -34,7 +34,7 @@ netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
 
 sleep 2
 
-if [ $(cat /proc/sys/reset) = 1 -o "$(nvram get failsafe)" = 1 ]; then
+if [ "$(cat /proc/sys/reset 2>&-)" = 1 -o "$(nvram get failsafe)" = 1 ]; then
        while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done &
        export FAILSAFE=true
        [ "$(nvram get boot_wait)" != "on" ] && {
index 4c24fc7d6f8bef6cd2bd073154ce744bdab13b8b..5f245fe83b2c203de275f85ef6dd32391fd40914 100755 (executable)
@@ -8,7 +8,7 @@ debug "### ifdown $type ###"
 if=$(nvram get ${type}_ifname)
 proto=$(nvram get ${type}_proto)
 if_valid $if && $DEBUG ifconfig $if down
-kill $(cat /var/run/${if}.pid 2>&-) 2>&-
+[ -r /var/run/${if}.pid ] && kill $(cat /var/run/${if}.pid 2>&-) 2>&-
 killall ifup.$proto >&- 2>&-
 case "$proto" in
        pptp|pppoe) killall pppd >&- 2>&- ;;
index 9fac6286c9ffcf1eb3b30a808d5899087845aee9..e94ef02694b6394efd5b847be5c578475119ea7d 100755 (executable)
@@ -27,9 +27,10 @@ case "$1" in
 
                if [ -n "$router" ] ; then
                        echo "deleting routers"
-                       while route del default gw 0.0.0.0 dev $interface ; do :; done
+                       while route del default gw 0.0.0.0 dev $interface >&- 2>&- ; do :; done
                                        
                        for i in $router ; do
+                               echo "adding router $i"
                                route add default gw $i dev $interface
                        done
                fi
@@ -37,8 +38,8 @@ case "$1" in
                echo -n > $RESOLV_CONF
                ${domain:+echo search $domain} >> $RESOLV_CONF
                for i in $dns ; do
-                       echo adding dns $i
-                       echo nameserver $i >> $RESOLV_CONF
+                       echo "adding dns $i"
+                       echo "nameserver $i" >> $RESOLV_CONF
                done
                
                hotplug_event ifup