[PATCH] really close all extra fds in bb_daemonize_or_rexec
Andreas Wetzel
andreas.wetzel at bridgeco.net
Tue Jul 1 01:26:31 PDT 2008
hi,
the current implementation seems not to reliably close all open file
descriptors if the flag DAEMON_CLOSE_EXTRA_FDS is set. it is assumed,
that the fd returned by opening a file (bb_dev_null) is the top-most fd,
but this is not true. open returns the first free fd. so, potentially,
some fds remain open.
the attached patch fixes this by calling close() on every possible file
descriptor (diffed against the busybox_1_9_stable branch).
cheers,
andi
--
Andreas Wetzel Core Software Engineer
BridgeCo AG Direct +41 44 802 33 19
Ringstrasse 14 Phone +41 44 802 33 33
CH-8600 Dübendorf Fax +41 44 802 33 39
Switzerland mailto:andreas.wetzel at bridgeco.net
http://www.bridgeco.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: close_extra_fds.patch
Type: text/x-diff
Size: 608 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20080701/6138a4df/attachment.patch
More information about the busybox
mailing list