There are 50 calls to close() in dnsmasq-2.80, and 10 of them are
wrapped in retry_send().

"man close" has this paragraph in the section "Dealing with error
returns from close":

"Retrying the close() after a failure return is the wrong thing to do,
since this may cause a reused file descriptor from another thread to
be closed. This can occur because the Linux kernel always releases the
file descriptor early in the close operation, freeing it for reuse;
the steps that may return an error, such as flushing data to the
filesystem or device, occur only later in the close operation".

Dnsmasq is single-threaded so the retry_send() call is probably
harmless. Are there other OSes that may return an error before the fd
is released, in other words is there an OS where wrapping close in
retry_send is required ?


Dnsmasq-discuss mailing list

Reply via email to