tags 392357 + patch
thanks

Hi,

Attached is the diff for my pcsc-lite 1.3.2-3.1 NMU.
diff -u pcsc-lite-1.3.2/debian/pcscd.init pcsc-lite-1.3.2/debian/pcscd.init
--- pcsc-lite-1.3.2/debian/pcscd.init
+++ pcsc-lite-1.3.2/debian/pcscd.init
@@ -25,6 +25,7 @@
 DESC="PCSC Lite resource manager"
 
 PIDFILE=/var/run/$NAME.pid
+PUBFILE=/var/run/$NAME.pub
 SCRIPTNAME=/etc/init.d/$NAME
 
 # Gracefully exit if the package has been removed (but not purged).
@@ -36,14 +37,16 @@
   start)
 	log_daemon_msg "Starting $DESC" $NAME
 	# if the daemon is already running we REstart it
-	if [ -f $PIDFILE ]; then
-	  log_progress_msg "already running, "
-	  $0 restart
-	else
-	  start-stop-daemon --start --quiet --pidfile $PIDFILE \
-	    --exec $DAEMON -- --error
-	  log_end_msg $?
+	if [ -f $PIDFILE ] || [ -f $PUBFILE ]; then
+	  log_progress_msg "already running, stopping,"
+	  start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
+	    --retry 10 --name $NAME
+	  log_progress_msg "restarting"
+	  rm -f $PIDFILE $PUBFILE
 	fi
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+	  --exec $DAEMON -- --error
+	log_end_msg $?
 	;;
 
   stop)
@@ -51,6 +54,7 @@
 	start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
 	  --retry 10 --name $NAME
 	log_end_msg $?
+	rm -f $PIDFILE $PUBFILE
 	;;
 
   restart|force-reload)
diff -u pcsc-lite-1.3.2/debian/changelog pcsc-lite-1.3.2/debian/changelog
--- pcsc-lite-1.3.2/debian/changelog
+++ pcsc-lite-1.3.2/debian/changelog
@@ -1,3 +1,19 @@
+pcsc-lite (1.3.2-3.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Fix issues with looping init script. (Closes: #392357)
+    * restart calls stop ; start, but start calls restart if the pid file
+      still exists. This is obviously not a good idea if stop doesn't remove
+      the pid file properly. Make start stop the daemon itself instead of
+      calling restart, which kills the loop.
+    * Also, make the stop target rm -f the pid file after calling
+      start-stop-daemon, just in case, and to avoid extraneous stops from the
+      start target.
+    * Finally, also check and rm /var/run/pcscd.pub, as the daemon doesn't
+      like starting if it's already there.
+
+ -- Steinar H. Gunderson <[EMAIL PROTECTED]>  Tue, 26 Dec 2006 13:45:25 +0100
+
 pcsc-lite (1.3.2-3) unstable; urgency=high
 
   * urgency high to correct a RC bug

Reply via email to