diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2000-08-22 21:53:24 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2000-08-22 21:53:24 +0000 |
| commit | 521e20a474a57a136cfd352da26022ed5c08342f (patch) | |
| tree | 35fe49a1b003a14711b863c39d3265fbc730caac | |
| parent | 4a6acafd554de785060b2b8f36ecb3bec8073a7c (diff) | |
Notes
| -rw-r--r-- | lib/libc/net/rcmd.3 | 5 | ||||
| -rw-r--r-- | lib/libc/net/res_send.c | 27 |
2 files changed, 22 insertions, 10 deletions
diff --git a/lib/libc/net/rcmd.3 b/lib/libc/net/rcmd.3 index 7aa77e1047da..63f7fb549358 100644 --- a/lib/libc/net/rcmd.3 +++ b/lib/libc/net/rcmd.3 @@ -99,10 +99,6 @@ is set to the standard name of the host and a connection is established to a server residing at the well-known Internet port .Fa inport . -It is up to the caller to free the memory associated with -.Fa *ahost -using -.Fn free . .Pp If the connection succeeds, a socket in the Internet domain of type @@ -268,7 +264,6 @@ is overloaded to mean ``All network ports in use.'' .Xr rlogin 1 , .Xr rsh 1 , .Xr intro 2 , -.Xr free 3 , .Xr rexec 3 , .Xr rexecd 8 , .Xr rlogind 8 , diff --git a/lib/libc/net/res_send.c b/lib/libc/net/res_send.c index ecc6087cb1c2..da196fba52bb 100644 --- a/lib/libc/net/res_send.c +++ b/lib/libc/net/res_send.c @@ -706,11 +706,17 @@ read_len: #ifndef NOPOLL othersyscall: if (use_poll) { + struct timeval itv; + msec = (_res.retrans << try) * 1000; if (try > 0) msec /= _res.nscount; if (msec <= 0) msec = 1000; + gettimeofday(&timeout, NULL); + itv.tv_sec = msec / 1000; + itv.tv_usec = (msec % 1000) * 1000; + timeradd(&timeout, &itv, &timeout); } else { #endif timeout.tv_sec = (_res.retrans << try); @@ -756,11 +762,22 @@ read_len: } else if (use_poll == 1) use_poll = 2; if (n < 0) { - if (errno == EINTR) - goto wait; - Perror(stderr, "poll", errno); - res_close(); - goto next_ns; + if (errno == EINTR) { + struct timeval ctv; + + gettimeofday(&ctv, NULL); + if (timercmp(&ctv, &timeout, <)) { + timersub(&timeout, + &ctv, &ctv); + msec = ctv.tv_sec * 1000; + msec += ctv.tv_usec / 1000; + goto wait; + } + } else { + Perror(stderr, "poll", errno); + res_close(); + goto next_ns; + } } } else { #endif |
