[Lunar-commits] <lunar> Preparing core tool for bash4, return values may no longer be negative

Stefan Wold ratler at lunar-linux.org
Wed Oct 14 07:32:13 CEST 2009


commit e6cf54b01b2c79cb7f80de0685aace4d361b37d3
Author: Stefan Wold <ratler at lunar-linux.org>
Date:   Wed Oct 14 07:32:13 2009 +0200

    Preparing core tool for bash4, return values may no longer be negative
---
 lib/lsb/init-functions                |   24 ++++++++++++------------
 var/lib/lunar/functions/edit.lunar    |    2 +-
 var/lib/lunar/functions/modules.lunar |    6 +++---
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/lib/lsb/init-functions b/lib/lsb/init-functions
index 52ce92a..cb1484c 100644
--- a/lib/lsb/init-functions
+++ b/lib/lsb/init-functions
@@ -128,7 +128,7 @@ pgrep () {
       if [ -d "/proc/$(cat $PIDFILE)" ] ; then
         return 0
       else
-        return -1
+        return 255
       fi
     else
       # sleep 1
@@ -137,10 +137,10 @@ pgrep () {
         if [ -d "/proc/$(cat $PIDFILE)" ] ; then
           return 0
         else
-          return -1
+          return 255
 	fi
       else
-        return -1
+        return 255
       fi
     fi
   fi
@@ -149,7 +149,7 @@ pgrep () {
 
 pkill () {
   if [ -z "$SERVPID" ] ; then
-    return -1
+    return 255
   else
     if kill -$SIGSTOP $SERVPID >& /dev/null ; then
       if [ -f $PIDFILE ] ; then
@@ -157,7 +157,7 @@ pkill () {
       fi
       return 0
     else
-      return -1
+      return 255
     fi
   fi
 }
@@ -165,12 +165,12 @@ pkill () {
 
 prload () {
   if [ ! -f $PIDFILE ] ; then
-    return -1
+    return 255
   else
     if kill -$SIGRELOAD $SERVPID >& /dev/null ; then
       return 0
     else
-      return -1
+      return 255
     fi
   fi
 }
@@ -179,7 +179,7 @@ prload () {
 mkpid () {
   if [ ! -e $PIDFILE ] ; then
     echo -n "[PID] "
-    /bin/pgrep -o -P 1 "^$PROCESS_BASE$" > $PIDFILE && return 0 || return -1
+    /bin/pgrep -o -P 1 "^$PROCESS_BASE$" > $PIDFILE && return 0 || return 255
   else 
     return 
   fi
@@ -191,10 +191,10 @@ pidok () {
     if pgrep ; then 
       return 0
     else
-      return -1
+      return 255
     fi
   else
-    return -1
+    return 255
   fi
 }
 
@@ -217,10 +217,10 @@ log_warning_msg () {
 start_process () {
   if [ ! -z "$RUNAS" ]; then
     /bin/su $RUNAS -c "$PROCESS_FULL $ARGS" &&
-      return 0 || return -1
+      return 0 || return 255
   else
     $PROCESS_FULL $ARGS &&
-    return 0 || return -1
+    return 0 || return 255
   fi
 }
 
diff --git a/var/lib/lunar/functions/edit.lunar b/var/lib/lunar/functions/edit.lunar
index e51f211..e3d6483 100644
--- a/var/lib/lunar/functions/edit.lunar
+++ b/var/lib/lunar/functions/edit.lunar
@@ -60,7 +60,7 @@ patch_it () {
 
   temp_destroy $TMPFILE1
   temp_destroy $TMPFILE2
-  return -1
+  return 255
 }
 
 
diff --git a/var/lib/lunar/functions/modules.lunar b/var/lib/lunar/functions/modules.lunar
index 80870c9..d29ebf1 100644
--- a/var/lib/lunar/functions/modules.lunar
+++ b/var/lib/lunar/functions/modules.lunar
@@ -238,12 +238,12 @@ run_details() {
     fi
 
     if [[ -z "$WANT_VERSION" ]] ; then
-      run_module_file $1 DETAILS &> /dev/null || return -1
+      run_module_file $1 DETAILS &> /dev/null || return 255
     else
       TMP_DETAILS=$(temp_create "details.version")
       cat $MOONBASE/$SECTION/$1/DETAILS | sed '/^\s*VERSION=/d' > $TMP_DETAILS
       VERSION="$WANT_VERSION"
-      . $TMP_DETAILS &> /dev/null || return -1
+      . $TMP_DETAILS &> /dev/null || return 255
       temp_destroy $TMP_DETAILS
     fi
     SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-$BUILD_DIRECTORY/$1-$VERSION}
@@ -564,7 +564,7 @@ module_is_expired() {
       fi
     fi
     # nope... it's not expired
-    return -1
+    return 255
   )
 }
 


More information about the Lunar-commits mailing list