A patch that fixes a logic bug that may be intebroduced in later ksh
implementations maybe. In the original code keep_trying exits non-zero
if it fails to get a semaphore. The negation of that triggers an exit,
but also changed $? from non-zero (true) to 0 meaning that the calling
script couldn't detemine that the semaphore was NOT obtained.

Also added alias of local to typeset as that automatic alias seems to
be missing in some newer ksh implementations.

Untar the original semaphore.tar, cd to:

 ./opt/local/semaphore/bin

and run

  patch < location_of_this_file

-- rouilj

--- semaphore.orig	2009-01-28 14:57:25.772463000 -0500
+++ semaphore	2009-03-19 17:00:15.037846000 -0400
@@ -33,6 +33,8 @@
 #  
 #=============================================================================
 
+alias local=typeset
+
 print_documentation()
 {
 	grep -v ^#= $LICENSE_FILE | cut -d'#' -f2- >&2
@@ -374,8 +376,10 @@
 				exit 2
 			fi
 		else
-			if ! keep_trying $semaphore $num_resources $pid $TIMEOUT_TRIES
+			if keep_trying $semaphore $num_resources $pid $TIMEOUT_TRIES
 			then
+			    :
+		 	else
 				exit $?
 			fi
 		fi
