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

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Jul 30 13:02:54 UTC 2013


Author: rousseau
Date: 2013-07-30 13:02:54 +0000 (Tue, 30 Jul 2013)
New Revision: 6699

Modified:
   trunk/PCSC/src/pcscdaemon.c
Log:
Check returned value of write(2) on synchronization socket

Fix compiler warnings:
pcscdaemon.c: In function ?\226?\128?\152main?\226?\128?\153:
pcscdaemon.c:639:3: warning: ignoring return value of ?\226?\128?\152write?\226?\128?\153, declared with attribute warn_unused_result [-Wunused-result]
pcscdaemon.c: In function ?\226?\128?\152at_exit?\226?\128?\153:
pcscdaemon.c:661:3: warning: ignoring return value of ?\226?\128?\152write?\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:59:14 UTC (rev 6698)
+++ trunk/PCSC/src/pcscdaemon.c	2013-07-30 13:02:54 UTC (rev 6699)
@@ -634,9 +634,14 @@
 	if (pipefd[1] >= 0)
 	{
 		char buf = 0;
+		ssize_t r;
 
 		/* write a 0 (success) to father process */
-		(void)write(pipefd[1], &buf, 1);
+		r = write(pipefd[1], &buf, 1);
+		if (r < 0)
+		{
+			Log2(PCSC_LOG_ERROR, "write() failed: %s", strerror(errno));
+		}
 		close(pipefd[1]);
 	}
 
@@ -655,10 +660,15 @@
 	if (pipefd[1] >= 0)
 	{
 		char buf;
+		ssize_t r;
 
 		/* write the error code to father process */
 		buf = ExitValue;
-		(void)write(pipefd[1], &buf, 1);
+		r = write(pipefd[1], &buf, 1);
+		if (r < 0)
+		{
+			Log2(PCSC_LOG_ERROR, "write() failed: %s", strerror(errno));
+		}
 		close(pipefd[1]);
 	}
 




More information about the Pcsclite-cvs-commit mailing list