[Pcsclite-cvs-commit] r4577 - /trunk/PCSC/src/pcscdaemon.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Nov 27 13:25:04 UTC 2009


Author: rousseau
Date: Fri Nov 27 13:25:04 2009
New Revision: 4577

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4577
Log:
improve the checking of an already running pcscd

Modified:
    trunk/PCSC/src/pcscdaemon.c

Modified: trunk/PCSC/src/pcscdaemon.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/pcscdaemon.c?rev=4577&op=diff
==============================================================================
--- trunk/PCSC/src/pcscdaemon.c (original)
+++ trunk/PCSC/src/pcscdaemon.c Fri Nov 27 13:25:04 2009
@@ -351,7 +351,8 @@
 			if (HotPlug)
 				return SendHotplugSignal();
 
-			if (kill(pid, 0) == 0)
+			rv = kill(pid, 0);
+			if (0 == rv)
 			{
 				Log1(PCSC_LOG_CRITICAL,
 					"file " PCSCLITE_CSOCK_NAME " already exists.");
@@ -360,8 +361,17 @@
 				return EXIT_FAILURE;
 			}
 			else
-				/* the old pcscd is dead. make some cleanup */
-				clean_temp_files();
+				if (ESRCH == errno)
+				{
+					/* the old pcscd is dead. make some cleanup */
+					clean_temp_files();
+				}
+				else
+				{
+					/* permission denied or other error */
+					Log2(PCSC_LOG_CRITICAL, "kill failed: %s", strerror(errno));
+					return EXIT_FAILURE;
+				}
 		}
 		else
 		{




More information about the Pcsclite-cvs-commit mailing list