From: Michael Tremer Date: Fri, 2 Sep 2016 11:52:25 +0000 (+0200) Subject: Log better errors when locks could not be acquired X-Git-Tag: 009~301 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20c4b654ba9a5027f59d7063b5a364ff0f370bd1;p=network.git Log better errors when locks could not be acquired Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.lock b/src/functions/functions.lock index b09b0b36..99da1f95 100644 --- a/src/functions/functions.lock +++ b/src/functions/functions.lock @@ -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. diff --git a/src/udev/network-hotplug-rename b/src/udev/network-hotplug-rename index c56c70d1..0b500184 100644 --- a/src/udev/network-hotplug-rename +++ b/src/udev/network-hotplug-rename @@ -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.