The use of the select statement in omapi/dispatch.c
dhcp at softsysgrp.com
dhcp at softsysgrp.com
Thu Aug 22 20:53:31 UTC 2002
The select statement below is used in the code and I think one of the
parameters is incorrect, or incorrect in non unix systems. The timeout
variable should be passed by address and the way it is written we are
passing a 0 address which would tell the select code to go to location 0 to
get the timeout value. As I recall, under unix systems, programs are
protected from using address 0 by the fact that a 0 is always in location 0.
count = select (max + 1, &r, &w, &x, t ? &to : (struct timeval
*)0);
I think what we want to do is to allocate a variable on the stack that has a
value of zero and then pass the address of that variable.
struct timeval dontWait;
memset(&dontWait, 0, sizeof(struct timeval));
count = select (max + 1, &r, &w, &x, t ? &to : &dontWait);
Maybe this was originally written as a short cut instead of using the above
code, knowing that address 0 always contains a 0, but in other systems it
produces interesting results.
I did not supply a patch file as I was not sure of the approved way to solve
the problem.
More information about the dhcp-hackers
mailing list