inetd fd leak?

Doug Graham dgraham at nortel.com
Thu Sep 3 23:16:33 UTC 2009


Doug Graham wrote:
> "inetd -e" does fix it for me, but LOG_NDELAY does not.
>
Thinking a bit more about this (I guess vfork is totally weird isn't a 
particularly satisfying answer),
and I think it probably goes something like this:

  - parent calls vfork
  - child running in shared address space calls closelog()
  - closelog closes the fd in the child but also sets a global (shared) 
variable to -1 to indicate that the
    log descriptor is not open
  - when parent is resumed after the child execs, it finds the global 
set to -1 and thinks the
    descriptor is not open.  So it opens it again and sets the global to 
the new descriptor.

Conclusion: vfork is totally weird :-)

--Doug



More information about the busybox mailing list