[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#52835: [PATCH 0/2] Fix spawning a child not setting standard fds pro
bug#52835: [PATCH 0/2] Fix spawning a child not setting standard fds properly
Tue, 28 Dec 2021 18:25:03 +0100
Timothy Sample <firstname.lastname@example.org> writes:
> One thing that ‘renumber_file_descriptor’ does that we seem to be losing
> here is error checking. To my eye, the old code will try and warn the
> user if they run out of file descriptors, but the new code will not.
I may have been too hasty on that front, you're right that we should
check for errors when dup'ing. Note though that we should not run out
of fds, as we close all of them except for in/out/err right before using
it, but still, here are the interesting error codes:
* EINTR, although OpenBSD and Linux will never set that error from my
* EBUSY, not POSIX though, only Linux, so should we?
* EMFILE, if we run out of fds;
* EBADF if either of the fds are invalid.
As for error reporting, should we keep the parent's stderr fd open while
we do all of this, just to be able to report an error in case it
happens? The old code used to try reporting the errors to the new `err`
fd instead, but it might be clearer to use stderr.