Commit 00c56be8 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

auto-build: fixed concurrent locks

All the build subshells attempted to lock with the parent shell's PID,
so could not exclude each other from build environments.
parent 499c5d70
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ running ()
	if [ -d /proc ]; then
		[ -e /proc/$1 ] || return 1
	elif type ps; then
		ps $1 || return 1
		ps -p $1 || return 1
	else
		return 1
	fi
@@ -123,7 +123,7 @@ _find_dist ()
_acquired_lock ()
{
	mkdir -p `dirname "$1"`
	ln -s $$ "$1" || [ `readlink "$1"` -eq $$ ]
	ln -s $BASHPID "$1" || [ `readlink "$1"` -eq $BASHPID ]
} 2>/dev/null

_clear_stale_lock ()
@@ -131,7 +131,7 @@ _clear_stale_lock ()
	local lock="$1" lockpid running

	lockpid=`readlink "$lock"` || return 0
	[ $lockpid -eq $$ ] && return 0
	[ $lockpid -eq $BASHPID ] && return 0 || true

	_acquired_lock "$lock.$lockpid" || return 1
	if ! running $lockpid; then