- correct treatment of timeout=NULL
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include "uselect.h"
|
#include "uselect.h"
|
||||||
|
|
||||||
/* an uninterruptable version of select. M.Z. Oct 2008 */
|
/* an uninterruptable version of select. M.Z. Oct 2008 */
|
||||||
@@ -9,10 +10,15 @@ int uselect(int nfds,
|
|||||||
struct timeval *timeout) {
|
struct timeval *timeout) {
|
||||||
|
|
||||||
sigset_t sigmask;
|
sigset_t sigmask;
|
||||||
struct timespec tmo;
|
struct timespec tmo, *tmoPtr;
|
||||||
|
|
||||||
sigfillset(&sigmask);
|
sigfillset(&sigmask);
|
||||||
|
if (timeout) {
|
||||||
tmo.tv_sec = timeout->tv_sec;
|
tmo.tv_sec = timeout->tv_sec;
|
||||||
tmo.tv_nsec = timeout->tv_usec * 1000;
|
tmo.tv_nsec = timeout->tv_usec * 1000;
|
||||||
return pselect(nfds, readfds, writefds, exceptfds, &tmo, &sigmask);
|
tmoPtr = &tmo;
|
||||||
|
} else {
|
||||||
|
tmoPtr = NULL;
|
||||||
|
}
|
||||||
|
return pselect(nfds, readfds, writefds, exceptfds, tmoPtr, &sigmask);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user