On Wed, Aug 14, 2019 at 04:19:46PM +0100, Simon McVittie wrote:
> On Wed, 14 Aug 2019 at 10:26:53 -0400, Brian Reichert wrote:
> Doesn't daemonize(1) make stdin, stdout and stderr point to /dev/null,
> instead of closing them?

Looking at the source, yes, it does.

> Expecting arbitrary subprocesses to cope gracefully with being invoked
> without the three standard fds seems likely to be a losing battle.
> I've implemented this myself, in dbus; it isn't a whole lot of code,
> but it also isn't something that I would expect the authors of all CLI
> tools to get right.

I concede that reopening FD 0,1,2 is a good practice to insulate
against the issues you cite.

I agree with your points; I code aggressively, and sometimes forget
others don't.

>     smcv
> 
> [1] I'm sure there are lots of other executables named daemon or daemonize
>     in other OSs, and perhaps some of them get this wrong?
> _______________________________________________
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel

-- 
Brian Reichert                          <reich...@numachi.com>
BSD admin/developer at large    
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to