Subject: PR 6410
To: None <current-users@netbsd.org>
From: maximum entropy <entropy@zippy.bernstein.com>
List: current-users
Date: 04/30/1999 19:48:45
Could someone please have a look at PR 6410?
The bug is very easy to reproduce (I included a minimal program and
instructions on how to reproduce a failure scenario in the PR). The
bug is also very easy to fix, and a patch was included, so I'm not
sure why this PR was ignored. If it's missing some important
information, please let me know so I can provide the needed
information.
The patch contained in the PR will no longer apply cleanly, because
the source file has been modified. Here's an updated patch.
--- /usr/src/lib/libc/net/res_send.c_orig Sun Nov 15 18:27:48 1998
+++ /usr/src/lib/libc/net/res_send.c Wed Apr 28 18:05:13 1999
@@ -498,6 +498,8 @@
* Use datagrams.
*/
time_t seconds;
+ time_t start_time;
+ time_t end_time;
struct pollfd dsfd;
struct sockaddr_in from;
int fromlen;
@@ -604,8 +606,14 @@
seconds = 1;
dsfd.fd = s;
dsfd.events = POLLIN;
+ start_time = time(0);
+ end_time = start_time + seconds;
wait:
+ seconds = end_time - start_time;
+ if (seconds < 0)
+ seconds = 0;
n = poll(&dsfd, 1, (int)(seconds * 1000));
+ start_time = time(0);
if (n < 0) {
if (errno == EINTR)
goto wait;
--
entropy -- it's not just a good idea, it's the second law.