[Pcsclite-cvs-commit] HandlerTest/Host handler_test.c,1.10,1.11

rousseau@quantz.debian.org rousseau@quantz.debian.org
Mon, 09 Feb 2004 14:42:58 +0100


Update of /cvsroot/pcsclite/HandlerTest/Host
In directory quantz:/tmp/cvs-serv17186

Modified Files:
	handler_test.c 
Log Message:
0 is a valid channel number (use sscanf instead of atoi)


Index: handler_test.c
===================================================================
RCS file: /cvsroot/pcsclite/HandlerTest/Host/handler_test.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- handler_test.c	9 Feb 2004 13:30:03 -0000	1.10
+++ handler_test.c	9 Feb 2004 13:42:56 -0000	1.11
@@ -187,11 +187,8 @@
 
 		// channel or device_name
 		if (argc - optind >= 2)
-		{
-			channel = atoi(argv[optind+1]);
-			if (channel == 0)
+			if (sscanf(argv[optind+1], "%d", &channel) != 1)
 				device_name = argv[optind+1];
-		}
 	}
 	else
 	{
@@ -199,8 +196,7 @@
 		{
 			// channel or device_name
 			case 1:
-				channel = atoi(argv[optind]);
-				if (channel == 0)
+				if (sscanf(argv[optind], "%d", &channel) != 1)
 					device_name = argv[optind];
 				break;