]> git.plutz.net Git - cgilite/blobdiff - storage.sh
bugfix: allow positive return of LOCK()
[cgilite] / storage.sh
index d4fbca36714a0cfe08db9ea9d465d43b3ef83b9c..8939fdc7c83fcb9bdde8cc1738ed1e4baabc3963 100755 (executable)
@@ -17,6 +17,9 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with CGIlite.  If not, see <http://www.gnu.org/licenses/>. 
 
+[ -n "$include_storage" ] && return 0
+include_storage="$0"
+
 LOCK(){
   lock="${1}.lock"
   timeout="${2-20}"
@@ -39,7 +42,7 @@ LOCK(){
     sleep 1
   done
   printf '%i\n' $$ >"${lock}/pid"
-  return 1
+  return 0
 }
 
 RELEASE(){
@@ -51,6 +54,7 @@ RELEASE(){
       printf '%i\n' $$ >"${lock}/pid"
       return 1
     fi
+    return 0
   else
     printf 'Refusing to release foreign lock: %s\n' "$lock" >&2
     return 1