]> git.ipfire.org Git - network.git/commitdiff
Log better errors when locks could not be acquired
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 2 Sep 2016 11:52:25 +0000 (13:52 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 2 Sep 2016 11:52:25 +0000 (13:52 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.lock
src/udev/network-hotplug-rename

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.
index c56c70d1a4ff06ff48811173cb9d12d77da7f7a5..0b5001842486a7f3738b3f2ab73c9234c4077918 100644 (file)
@@ -45,7 +45,7 @@ log DEBUG "Called for interface '${INTERFACE}'."
 device_exists ${INTERFACE} || exit ${EXIT_ERROR}
 
 # Acquiring lock for this operation.
-lock_acquire ${LOCKFILE}
+lock_acquire ${LOCKFILE} || exit ${EXIT_ERROR}
 
 # Check if the device is already in use and
 # prevent the script to touch it in any way.