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

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Jul 30 13:05:53 UTC 2013


Author: rousseau
Date: 2013-07-30 13:05:52 +0000 (Tue, 30 Jul 2013)
New Revision: 6700

Modified:
   trunk/PCSC/src/testpcsc.c
Log:
Check returned value of fgets(3)

Fix compiler warning:
testpcsc.c: In function ?\226?\128?\152main?\226?\128?\153:
testpcsc.c:190:4: warning: ignoring return value of ?\226?\128?\152fgets?\226?\128?\153, declared with attribute warn_unused_result [-Wunused-result]


Modified: trunk/PCSC/src/testpcsc.c
===================================================================
--- trunk/PCSC/src/testpcsc.c	2013-07-30 13:02:54 UTC (rev 6699)
+++ trunk/PCSC/src/testpcsc.c	2013-07-30 13:05:52 UTC (rev 6700)
@@ -185,10 +185,14 @@
 		do
 		{
 			char input[80];
+			char *r;
 
 			printf("Enter the reader number\t\t: ");
-			(void)fgets(input, sizeof(input), stdin);
-			iReader = atoi(input);
+			r = fgets(input, sizeof(input), stdin);
+			if (NULL == r)
+				iReader = -1;
+			else
+				iReader = atoi(input);
 
 			if (iReader > p || iReader <= 0)
 				printf("Invalid Value - try again\n");




More information about the Pcsclite-cvs-commit mailing list