Paul R. Ganci
ganci@nurdog.com
Sun, 19 Feb 2006 16:05:45 -0700
Paul R. Ganci wrote:
> Therefore I backed out only that change to the 1.3.25 dccd.c version
> with the patch attached at the bottom of this message. When I rebuild
> DCC with this change then the dccd grey lister functions correctly
> once again. I
Hi Vernon,
I was looking at the following code excerpts and think I see a bug.
Admittedly my C programming abilities have deteriorated over time from
lack of use so please show no mercy in shooting this down. However, I
think the open_srvr_code() found in 1.3.29 is not what is intended.
From 1.3.25:
static void open_srvr_socs(int *);
if (get_if_changes(1)) {
open_srvr_socs(0);
flods_restart("network interfaces changed");
}
static void
open_srvr_socs(int *retry_secs)
{
if (!dcc_udp_bind(dcc_emsg, &sp->udp,
&sp->su, retry_secs)) {
Note that dcc_upd_bind is taking a pointer to int in the last argument.
That address will point at an int containing the value 0 from the
open_srvr_socs(0); call in the if statement above it.
Now from 1.3.29:
static int open_srvr_socs(int);
if (get_if_changes(1)) {
int socs = open_srvr_socs(0);
if (!socs)
bad_stop("failed to open any server
sockets");
else if (socs > 0)
flods_restart("network interfaces changed");
}
static int /* # of sockets opened */
open_srvr_socs(int retry_secs)
{
int *retry_secsp;
retry_secsp = retry_secs ? &retry_secs : 0;
if (!dcc_udp_bind(dcc_emsg, &sp->udp,
&sp->su, retry_secsp)) {
Now note that open_srvr_socs() takes an int as an argument and that
retry_secsp is a pointer to int. When the open_srvr_socs(0) call is made
retry_secsp address will be null (0) since retry_secs will equal 0.
Hence you pass a null pointer to dcc_upd_bind() as the last argument
retry_secsp instead of a pointer to an int containing the value 0.
If my analysis is correct this code might work randomly depending on
system. Again my analysis could be completely wrong, but I don't think
it is. Backing out to version 1.3.25 would fix this problem if I am
correct ... this is what I see. There are probably other simpler fixes,
but I didn't explore them.
--
Paul (ganci@nurdog.com)