|
|
@ -2584,11 +2584,12 @@ char * sprint_tm( int t )
|
|
|
|
void u_sleep( int u_sec )
|
|
|
|
void u_sleep( int u_sec )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int nfound;
|
|
|
|
int nfound;
|
|
|
|
struct timeval to;
|
|
|
|
struct timeval to, tokeep;
|
|
|
|
fd_set readset, writeset;
|
|
|
|
fd_set readset, writeset;
|
|
|
|
|
|
|
|
|
|
|
|
to.tv_sec = u_sec / 1000000;
|
|
|
|
to.tv_sec = u_sec / 1000000;
|
|
|
|
to.tv_usec = u_sec - ( to.tv_sec * 1000000 );
|
|
|
|
to.tv_usec = u_sec - ( to.tv_sec * 1000000 );
|
|
|
|
|
|
|
|
tokeep = to;
|
|
|
|
|
|
|
|
|
|
|
|
FD_ZERO( &readset );
|
|
|
|
FD_ZERO( &readset );
|
|
|
|
FD_ZERO( &writeset );
|
|
|
|
FD_ZERO( &writeset );
|
|
|
@ -2598,6 +2599,10 @@ select_again:
|
|
|
|
if(nfound < 0) {
|
|
|
|
if(nfound < 0) {
|
|
|
|
if(errno == EINTR) {
|
|
|
|
if(errno == EINTR) {
|
|
|
|
/* interrupted system call: redo the select */
|
|
|
|
/* interrupted system call: redo the select */
|
|
|
|
|
|
|
|
to = tokeep;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FD_ZERO( &readset );
|
|
|
|
|
|
|
|
FD_ZERO( &writeset );
|
|
|
|
goto select_again;
|
|
|
|
goto select_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
@ -2632,7 +2637,7 @@ int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, long timo )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
unsigned int slen;
|
|
|
|
unsigned int slen;
|
|
|
|
int nfound, n;
|
|
|
|
int nfound, n;
|
|
|
|
struct timeval to;
|
|
|
|
struct timeval to, tokeep;
|
|
|
|
fd_set readset, writeset;
|
|
|
|
fd_set readset, writeset;
|
|
|
|
|
|
|
|
|
|
|
|
to.tv_sec = 0;
|
|
|
|
to.tv_sec = 0;
|
|
|
@ -2641,6 +2646,7 @@ int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, long timo )
|
|
|
|
to.tv_sec++;
|
|
|
|
to.tv_sec++;
|
|
|
|
to.tv_usec -= 1000000;
|
|
|
|
to.tv_usec -= 1000000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tokeep = to;
|
|
|
|
|
|
|
|
|
|
|
|
FD_ZERO( &readset );
|
|
|
|
FD_ZERO( &readset );
|
|
|
|
FD_ZERO( &writeset );
|
|
|
|
FD_ZERO( &writeset );
|
|
|
@ -2651,6 +2657,11 @@ select_again:
|
|
|
|
if(nfound < 0) {
|
|
|
|
if(nfound < 0) {
|
|
|
|
if(errno == EINTR) {
|
|
|
|
if(errno == EINTR) {
|
|
|
|
/* interrupted system call: redo the select */
|
|
|
|
/* interrupted system call: redo the select */
|
|
|
|
|
|
|
|
to = tokeep;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FD_ZERO( &readset );
|
|
|
|
|
|
|
|
FD_ZERO( &writeset );
|
|
|
|
|
|
|
|
FD_SET( s, &readset );
|
|
|
|
goto select_again;
|
|
|
|
goto select_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|