Module Name: src
Committed By: tron
Date: Wed Oct 7 08:06:11 UTC 2009
Modified Files:
src/etc/rc.d: staticroute
Log Message:
Add proper error reporting via the return code:
Remember if any of the "route" commands failed and return an error in
that case.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/etc/rc.d/staticroute
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/etc/rc.d/staticroute
diff -u src/etc/rc.d/staticroute:1.4 src/etc/rc.d/staticroute:1.5
--- src/etc/rc.d/staticroute:1.4 Wed Oct 7 07:51:28 2009
+++ src/etc/rc.d/staticroute Wed Oct 7 08:06:11 2009
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: staticroute,v 1.4 2009/10/07 07:51:28 tron Exp $
+# $NetBSD: staticroute,v 1.5 2009/10/07 08:06:11 tron Exp $
#
# PROVIDE: staticroute
@@ -16,6 +16,8 @@
stop_cmd="staticroute_doit Deleting delete"
staticroute_doit() {
+ retval=0
+
if [ -s /etc/route.conf ]; then
echo "$1 static routes."
while read args; do
@@ -24,19 +26,23 @@
"#"*)
;;
"+"*)
- [ $2 = "add" ] && eval ${args#*+}
+ if [ $2 = "add" ]; then
+ eval ${args#*+} || retval=1
+ fi
;;
"-"*)
- [ $2 = "delete" ] && eval ${args#*-}
+ if [ $2 = "delete" ]; then
+ eval ${args#*-} || retval=1
+ fi
;;
*)
- route -q $2 -$args
+ route -q $2 -$args || retval=1
;;
esac
done < /etc/route.conf
fi
- return 0
+ return $retval
}
load_rc_config $name