NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: misc/49738 rc.subr leaks filedescriptors



    Date:        Thu, 20 Oct 2016 11:02:12 -0400
    From:        christos%zoulas.com@localhost (Christos Zoulas)
    Message-ID:  <20161020150212.8EFD617FDAB%rebar.astron.com@localhost>

  | How about:
  | http://www.netbsd.org/~christos/cloexec.diff and adding:
  | 
  | cloexec +7 +8 in /etc/rc?

It would want to include fd 9 as well ... but at the expense of adding
more non-standard baggage to NetBSD's sh, and having the rc system not
workable on any other sh, then that would work.

I believe that mostly the rc system correctly closed the fd's it opens
(which is the standard way to handle this) - but that this fails when the
rc.d/script has its oeb start function (as for example, lvm does) which
knows nothing about needing to close rc maintained (they are not from rc.subr
the Subject of this PR is incorrect) file descriptors.

An alternative would be to add a new function to the rc system for scripts
to call, to close any fd's that the rc system has opened, and then have
the relevant scripts call that function - it could be made reasonably general
to allow for other similar future issues, perhaps "rc_exec_cleanup" or
something.

kre



Home | Main Index | Thread Index | Old Index