[PATCH 2/2] Xinit: close stdin to avoid leak of file descriptior to the Xorg session.

Jeremy Huddleston jeremyhu at apple.com
Tue Jul 26 13:02:11 PDT 2011


On Jul 26, 2011, at 12:23 PM, Ray Strode wrote:

> Hi,
> 
> On Tue, Jul 26, 2011 at 2:57 PM, Jeremy Huddleston <jeremyhu at apple.com> wrote:
>> yick... ok, well I'd suggest making that its own patch rather than squashed > into the stdin one... I dunno how I feel about it and will let others chime in...
> It's two pieces of the same thing.  There's not much point in setting
> stdin to /dev/null but leaving the controlling tty the same.  The
> point of all the steps (as I see it anyway) is a common end goal of
> detaching the new X session that's getting launched from the existing
> session running on the tty. Another way you could think of it, is it's
> basically doing the same fork()/close/dup2/setsid dance a libc
> daemon() call would do but without the final exit-in-parent.


IMO, there is a point to closing stdin aside from the setsid(2).




More information about the xorg-devel mailing list