svn rev #21976: tools/gssmonger/trunk/gssmaster/
raeburn@MIT.EDU
raeburn at MIT.EDU
Thu Feb 12 12:30:32 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=21976
Commit By: raeburn
Log Message:
pass correct maxfd to select for unix; check for pthread_create error
Changed Files:
U tools/gssmonger/trunk/gssmaster/clientapis.c
Modified: tools/gssmonger/trunk/gssmaster/clientapis.c
===================================================================
--- tools/gssmonger/trunk/gssmaster/clientapis.c 2009-02-12 17:29:34 UTC (rev 21975)
+++ tools/gssmonger/trunk/gssmaster/clientapis.c 2009-02-12 17:30:31 UTC (rev 21976)
@@ -1342,7 +1342,7 @@
ServerLogListeningThread( IN OUT HLOGTHREAD hThread ) {
DWORD dwErr = ERROR_SUCCESS;
- SOCKET tmpsock;
+ SOCKET tmpsock, maxfd;
ULONG i;
int nSet;
fd_set readset, errorset;
@@ -1431,13 +1431,16 @@
FD_SET( hThread->ListeningSocket,
&readset );
+ maxfd = hThread->ListeningSocket;
for ( i = 0 ;
i < hThread->Sockets.cSockets ;
i ++ ) {
- FD_SET( hThread->Sockets.pSockets[ i ],
- &readset );
+ SOCKET f = hThread->Sockets.pSockets[ i ];
+ FD_SET( f, &readset );
+ if (maxfd < f)
+ maxfd = f;
}
@@ -1445,13 +1448,12 @@
&readset,
sizeof( errorset ) );
- nSet = select( 0, // ignored
+ nSet = select( maxfd+1, // ignored on Windows, important on UNIX
&readset,
NULL, // writeset -- never need to write
&errorset,
&tv );
-
if ( nSet == SOCKET_ERROR ) {
ezLogMsgA( EZLOG_WARN,
@@ -1676,7 +1678,6 @@
}
return dwErr;
-
}
BOOL
@@ -1689,6 +1690,7 @@
struct sockaddr_storage Addr = { 0 };
int AddrLen = sizeof( Addr );
char PortStr[6];
+ int err;
if ( MMALLOC( sizeof( *hThread ),
@@ -1811,10 +1813,15 @@
hThread->hThread = malloc(sizeof(pthread_t));
- pthread_create( (pthread_t*)(hThread->hThread),
- NULL,
- (void*(*)(void*))ServerLogListeningThread,
- (PVOID) hThread );
+ err = pthread_create( &hThread->hThread,
+ NULL,
+ (void*(*)(void*))ServerLogListeningThread,
+ (PVOID) hThread );
+ if (err) {
+ fprintf(stderr, "Can't create logging thread: %s\n",
+ strerror(err));
+ ret = FALSE;
+ }
#endif // WINNT
More information about the cvs-krb5
mailing list