[Pcsclite-cvs-commit] r2352 - trunk/PCSC/src
Ludovic Rousseau
rousseau at alioth.debian.org
Tue Jan 23 09:50:32 CET 2007
Author: rousseau
Date: 2007-01-23 09:50:31 +0100 (Tue, 23 Jan 2007)
New Revision: 2352
Modified:
trunk/PCSC/src/pcscdaemon.c
trunk/PCSC/src/winscard_msg_srv.c
Log:
FreeBSD needs to timeout in select() to get the Ctrl-C signal
Revert revision 2148 and 2149 for *BSD
Thanks to Tilman Linneweh for the bug report
Modified: trunk/PCSC/src/pcscdaemon.c
===================================================================
--- trunk/PCSC/src/pcscdaemon.c 2007-01-20 15:47:19 UTC (rev 2351)
+++ trunk/PCSC/src/pcscdaemon.c 2007-01-23 08:50:31 UTC (rev 2352)
@@ -211,6 +211,14 @@
break;
+ case 2:
+ /*
+ * timeout in SHMProcessEventsServer(): do nothing
+ * this is used to catch the Ctrl-C signal at some time when
+ * nothing else happens
+ */
+ break;
+
case -1:
Log1(PCSC_LOG_ERROR, "Error in SHMProcessEventsServer");
break;
Modified: trunk/PCSC/src/winscard_msg_srv.c
===================================================================
--- trunk/PCSC/src/winscard_msg_srv.c 2007-01-20 15:47:19 UTC (rev 2351)
+++ trunk/PCSC/src/winscard_msg_srv.c 2007-01-23 08:50:31 UTC (rev 2352)
@@ -165,10 +165,19 @@
* @retval -1 Can not set the connection to non-blocking mode.
* @retval 2 Timeout.
*/
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#define DO_TIMEOUT
+#endif
INTERNAL int SHMProcessEventsServer(PDWORD pdwClientID, int blocktime)
{
fd_set read_fd;
int selret;
+#ifdef DO_TIMEOUT
+ struct timeval tv;
+
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
+#endif
FD_ZERO(&read_fd);
@@ -178,7 +187,13 @@
FD_SET(commonSocket, &read_fd);
selret = select(commonSocket + 1, &read_fd, (fd_set *) NULL,
- (fd_set *) NULL, NULL);
+ (fd_set *) NULL,
+#ifdef DO_TIMEOUT
+ &tv
+#else
+ NULL
+#endif
+ );
if (selret < 0)
{
@@ -190,6 +205,10 @@
return -1;
}
+ if (selret == 0)
+ /* timeout. On *BSD only */
+ return 2;
+
/*
* A common pipe packet has arrived - it could be a new application
*/
More information about the Pcsclite-cvs-commit
mailing list