On 10/25/22 19:04, Zebediah Figura (@zfigura) wrote:
Zebediah Figura (@zfigura) commented about server/sock.c:
- struct bound_addr *bound_addr;
- if (!(bound_addr = malloc( sizeof(*bound_addr) )))
fatal_error( "out of memory\n" );
- if (rb_put( &bound_addresses_tree, addr, &bound_addr->entry ))
- {
free( bound_addr );
bound_addr = WINE_RB_ENTRY_VALUE(rb_get( &bound_addresses_tree, addr ), struct bound_addr, entry);
if (bound_addr->reuse_count == -1)
{
if (debug_level)
fprintf( stderr, "register_bound_address: address being updated is already exclusively bound\n" );
return NULL;
}
++bound_addr->reuse_count;
Under what circumstances can this happen? Should this be an assert() instead?
(I know that we don't want to bring down the server, but I think it's better to assert than go ahead with something that really shouldn't be the case. Alexandre might disagree with me, though.)
Well, I think that normally it should not happen. But note that we (have to) block the address we get after getting the socket name after bind. Unfortunately I can't say for sure if it ever can change the address from, e. g., ANY to some specific, maybe it can at some specific configuration, and I guess such case would be very hard to handle, while maybe not strictly necessary. So I'd really prefer to just let it proceed with bind in such case and fail later on listen.