sys-process/cronbase: second attempt at fixing bug 595492
authorTobias Klausmann <klausman@gentoo.org>
Fri, 30 Sep 2016 14:15:45 +0000 (16:15 +0200)
committerTobias Klausmann <klausman@gentoo.org>
Fri, 30 Sep 2016 14:17:45 +0000 (16:17 +0200)
In the case of a stale lockfile, the old code still produces error
messages:

/usr/sbin/run-crons: line 61: /proc/6450/cmdline: No such file or
directory

This change should dodge that scenario.

sys-process/cronbase/cronbase-0.3.7-r3.ebuild [moved from sys-process/cronbase/cronbase-0.3.7-r2.ebuild with 100% similarity]
sys-process/cronbase/files/run-crons-0.3.7

index c5f2d9ca7b333833b9c8deaa894430adac4d511b..ce8ff76e98bb2773f2414f3cfa870aa325729878 100755 (executable)
@@ -58,7 +58,7 @@ grab_lock() {
                # another run-crons process.
                # The tr call deletes null bytes so newer bash versions do not complain
                # about them.
-               cmdline1=$(tr -d '\0'  < "/proc/${cronpid}/cmdline" 2>/dev/null) || :
+               cmdline1=$([ -r "/proc/${cronpid}/cmdline" ] && tr -d '\0'  < "/proc/${cronpid}/cmdline" 2>/dev/null) || :
                cmdline2=$(tr -d '\0'  < /proc/$$/cmdline)
                if [ "${cmdline1}" = "${cmdline2}" ] ; then
                        # Whoa, another run-crons is really running.