[Pcsclite-cvs-commit] r6698 - trunk/PCSC/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Jul 30 12:59:14 UTC 2013


Author: rousseau
Date: 2013-07-30 12:59:14 +0000 (Tue, 30 Jul 2013)
New Revision: 6698

Modified:
   trunk/PCSC/src/pcscdaemon.c
Log:
Check returned value from chdir(2)

Fix compiler warning:
pcscdaemon.c: In function ?\226?\128?\152main?\226?\128?\153:
pcscdaemon.c:401:2: warning: ignoring return value of ?\226?\128?\152chdir?\226?\128?\153, declared with attribute warn_unused_result [-Wunused-result]


Modified: trunk/PCSC/src/pcscdaemon.c
===================================================================
--- trunk/PCSC/src/pcscdaemon.c	2013-07-30 12:56:20 UTC (rev 6697)
+++ trunk/PCSC/src/pcscdaemon.c	2013-07-30 12:59:14 UTC (rev 6698)
@@ -149,6 +149,7 @@
 	int customMaxThreadCardHandles = 0;
 	int opt;
 	int limited_rights = FALSE;
+	int r;
 #ifdef HAVE_GETOPT_LONG
 	int option_index = 0;
 	static struct option long_options[] = {
@@ -398,7 +399,12 @@
 
 	/* like in daemon(3): changes the current working directory to the
 	 * root ("/") */
-	(void)chdir("/");
+	r = chdir("/");
+	if (r < 0)
+	{
+		Log2(PCSC_LOG_CRITICAL, "chdir() failed: %s", strerror(errno));
+		return EXIT_FAILURE;
+	}
 
 	/*
 	 * If this is set to one the user has asked it not to fork




More information about the Pcsclite-cvs-commit mailing list