bb_daemonize_or_rexec(DAEMON_CLOSE_EXTRA_FDS) does not close extra fds

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Sat Mar 16 00:41:27 UTC 2019


On Thu, 14 Mar 2019 17:01:16 +0100
Bernd Petrovitsch <bernd at petrovitsch.priv.at> wrote:

> >  Thoughts?  
> 
> https://stackoverflow.com/questions/1315382/closing-all-open-files-in-a-process
> has something:
> - Use https://man.openbsd.org/closefrom.2 - which doesn't exist on
>   Linux.
> - use getdtablesize()
> - use sysconf(_SC_OPEN_MAX)


As Denys notes another common magic value seen in the wild is 1024.

RLIMIT_NOFILE, SC_OPEN_MAX, POSIX_OPEN_MAX, FOPEN_MAX come to mind, too.

Maybe someone should file a defect against SUS/POSIX to mandate
something sensible throughout, at least mid- or longterm?

thanks, 


More information about the busybox mailing list