tags 494385 patch
thanks

Hello list,

A debian user pointed this out bug and it's actually a bug in the init
script exiting with status 1 when you call stop and it's already
stopped. This is against the LSB standard as well
(http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html).

Attached is a patch to fix this (and abstracts things a bit).

PS please keep the Cc line on the reply.

* Wouter Verhelst ([EMAIL PROTECTED]) wrote:
> Package: openct
> Version: 0.6.14-2
> Severity: serious
> 
> Hi,
> 
> If openct isn't running, the openct init script exits with a non-zero
> exit state. The prerm doesn't catch this condition, and fails. That
> shouldn't happen.
> 
> I'm not entirely sure whether exiting an initscript with a non-zero exit
> state is allowed in this case either, but I'll leave that for others to
> decide ;-)


-- 
Eric Dorland <[EMAIL PROTECTED]>
ICQ: #61138586, Jabber: [EMAIL PROTECTED]

diff --git a/etc/init-script.in b/etc/init-script.in
index a6fc0dc..8db6fed 100644
--- a/etc/init-script.in
+++ b/etc/init-script.in
@@ -15,6 +15,8 @@
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=SBINDIR/openct-control
+STATUS_DIR=/var/run/openct
+STATUS_FILE="$STATUS_DIR/status"
 NAME=OpenCT
 DESC="smart card terminal framework"
 
@@ -22,16 +24,16 @@ test -x $DAEMON || exit 0
 
 # create the directory for our status and socket files,
 # if it does not exist.
-if ! test -e /var/run/openct
+if ! test -e $STATUS_DIR
 then
-	mkdir /var/run/openct
+	mkdir $STATUS_DIR
 
 	# maybe you also want to set owner ship and permissions here.
 	# this example would assign the directory to a group "scard"
 	# and set permissions so only users in that group can access
 	# smart card readers via openct.
-	chown root:scard /var/run/openct
-	chmod 0750 /var/run/openct
+	chown root:scard $STATUS_DIR
+	chmod 0750 $STATUS_DIR
 fi
 
 set -e
@@ -44,8 +46,10 @@ case "$1" in
 	;;
   stop)
 	echo -n "Stopping $DESC: $NAME "
-	$DAEMON shutdown
-	rm /var/run/openct/status
+	if [ -f $STATUS_FILE ]; then
+	        $DAEMON shutdown
+	        rm -f $STATUS_FILE
+        fi
 	echo "."
 	;;
   #reload)
@@ -68,9 +72,9 @@ case "$1" in
 	#	just the same as "restart".
 	#
 	echo -n "Restarting $DESC: $NAME"
-	if [ -f /var/run/openct/status ]; then
+	if [ -f $STATUS_FILE ]; then
 		$DAEMON shutdown
-		rm -f /var/run/openct/status
+		rm -f $STATUS_FILE
 	fi
 	sleep 0.1
 	$DAEMON init

Attachment: signature.asc
Description: Digital signature

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to