forked from extern/shorewall_code
Fix mutex on OpenWRT - patch 1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
5083246266
commit
1fa77ac470
@ -766,23 +766,22 @@ mutex_on()
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} removed"
|
||||
elif [ $lockpid -eq $$ ]; then
|
||||
return 0
|
||||
elif ! ps | grep -v grep | qt grep ${lockpid}; then
|
||||
fatal_error "Mutex_on confusion"
|
||||
elif ! qt ps --pid ${lockpid}; then
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
|
||||
fi
|
||||
fi
|
||||
|
||||
if qt mywhich lockfile; then
|
||||
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf}
|
||||
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf} || fatal_error "Can't lock ${lockf}"
|
||||
g_havemutex="rm -f ${lockf}"
|
||||
chmod u+w ${lockf}
|
||||
echo $$ > ${lockf}
|
||||
chmod u-w ${lockf}
|
||||
elif qt mywhich lock; then
|
||||
lock ${lockf}
|
||||
g_havemutex="lock -u ${lockf} && rm -f ${lockf}"
|
||||
chmod u=r ${lockf}
|
||||
lock ${lockf} || fatal_error "Can't lock ${lockf}"
|
||||
g_havemutex="lock -u ${lockf}"
|
||||
else
|
||||
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
|
||||
sleep 1
|
||||
|
Loading…
Reference in New Issue
Block a user