fix warning regarding null byte

This commit is contained in:
Ryan Cavicchioni 2020-05-09 11:00:06 -05:00
parent 1cc7ba9fb1
commit e75481b2f5
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -71,9 +71,12 @@ if [ -f "$LOCK" ]; then
printf "removing orphaned lock, pid %d does not exist\n" "$pid"
rm -f "$LOCK"
else
if [[ -f "/proc/${pid}/cmdline" ]] && ! [[ $(cat "/proc/${pid}/cmdline") =~ $(basename "$0") ]]; then
if [[ -f "/proc/${pid}/cmdline" ]]; then
cmdline=$(tr "\0" " " <"/proc/${pid}/cmdline")
if ! [[ $cmdline =~ $(basename "$0") ]]; then
printf "removing orphaned lock, pid %d belongs to another process\n" "$pid"
rm -f "$LOCK"
fi
else
KEEP_LOCK=1
error_exit "another job is running, pid=${pid}"