]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.lock
Log better errors when locks could not be acquired
[people/ms/network.git] / src / functions / functions.lock
index b09b0b3623ecb7f4569605675fff1eb6fc04a974..99da1f952857b8dc149d32453e049b1f8e39a016 100644 (file)
@@ -40,7 +40,12 @@ lock_acquire() {
                sleep 0.25
        done
 
-       assert ${free} "Could not acquire lock '${lockfile}'"
+       if ! ${free}; then
+               log ERROR "Could not acquire lock '${lockfile}'"
+               return ${EXIT_ERROR}
+       fi
+
+       assert [ ! -e "${lockfile}" ]
 
        # Write out pid to the lockfile and make sure that
        # nobody else can access it.