SOURCES: ipset.init - use $RETVAL for exit status. NOTE: stop shou...

glen glen at pld-linux.org
Tue Dec 11 10:47:25 CET 2007


Author: glen                         Date: Tue Dec 11 09:47:25 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use $RETVAL for exit status. NOTE: stop should never fail

---- Files affected:
SOURCES:
   ipset.init (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: SOURCES/ipset.init
diff -u SOURCES/ipset.init:1.2 SOURCES/ipset.init:1.3
--- SOURCES/ipset.init:1.2	Tue Dec 11 07:49:25 2007
+++ SOURCES/ipset.init	Tue Dec 11 10:47:20 2007
@@ -19,7 +19,13 @@
 	if [ -f $IPSET_CONFIG ]; then
 		show "Applying ipset rules"
 		/usr/sbin/ipset -X
-		/usr/sbin/ipset -R < $IPSET_CONFIG && ok || fail
+		/usr/sbin/ipset -R < $IPSET_CONFIG
+	   	RETVAL=$?
+		if [ $RETVAL = 0 ]; then
+			ok
+		else
+			fail
+		fi
 		touch /var/lock/subsys/ipset
 	fi
 }
@@ -30,18 +36,16 @@
 	rm -f /var/lock/subsys/ipset
 }
 
+RETVAL=0
 case "$1" in
   start)
 	start
-	exit $?
 	;;
   stop)
 	stop
-	exit $?
 	;;
   restart|force-reload)
 	start
-	exit $?
 	;;
   status)
 	/usr/sbin/ipset -L --sorted --numeric
@@ -51,10 +55,17 @@
 	show "Saving current rules to %s" $IPSET_CONFIG
 	touch $IPSET_CONFIG
 	chmod 600 $IPSET_CONFIG
-	/usr/sbin/ipset -S > $IPSET_CONFIG && ok || fail
-	exit $?
+	/usr/sbin/ipset -S > $IPSET_CONFIG
+   	RETVAL=$?
+	if [ $RETVAL = 0 ]; then
+		ok
+	else
+		fail
+	fi
 	;;
   *)
 	msg_usage "$0 {start|stop|restart|force-reload|status|save}"
 	exit 3
 esac
+
+exit $RETVAL
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/ipset.init?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list