On 07/26/2018 09:54 AM, Brian J. Murrell wrote:
> On Thu, 2018-07-26 at 08:51 -0700, Tom Eastep wrote:
>>
>> Brian,
> 
> Hi Tom,
> 
>> Can you point me to online documentation that describes how this
>> 'lock'
>> utility is supposed to work?
> 
> It's a busybox applet added to busybox by OpenWRT.  Here's the source
> for it:
> 
> https://github.com/openwrt/openwrt/blob/154c0c4006daf41e2cbb6c8b7ad5557f83dfea3e/package/utils/busybox/patches/220-add_lock_util.patch
> 
> There seems to be minimal documentation at:
> 
> https://wiki.openwrt.org/inbox/script/manual_busybox_functions_openwrt
> 

Thanks Brian,

Please see if this patch resolves the issue. The lib.common file has not
changed since 5.1.12.3 (other than the banner version) so you can apply
the patch on your admin system then copy lib.common to the router.

Thanks,
-Tom
-- 
Tom Eastep        \   Q: What do you get when you cross a mobster with
Shoreline,         \     an international standard?
Washington, USA     \ A: Someone who makes you an offer you can't
http://shorewall.org \   understand
                      \_______________________________________________
diff --git a/Shorewall-core/lib.common b/Shorewall-core/lib.common
index 7567123a7..205fc705f 100644
--- a/Shorewall-core/lib.common
+++ b/Shorewall-core/lib.common
@@ -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

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Shorewall-users mailing list
Shorewall-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to