[Xcb] [PATCH] Open the X11 socket with close-on-exec flag

Rémi Denis-Courmont remi at remlab.net
Sat Feb 13 02:29:38 PST 2010


Le samedi 13 février 2010 12:23:51 Rémi Denis-Courmont, vous avez écrit :
> This saves the X11 connection from leaking into children processes.
> On Linux, this is fully thread-safe using SOCK_CLOEXEC. On other
> systems, there is a small race condition.

I assume you all know what close-on-exec does, but some background maybe...

LibVLC sometimes spawns a child process, while (obviously) it is connect to 
the X11 server. The invocation of xdg-screensaver is the most common case. 
With this patch, the socket is automatically closed when the child process 
invokes exec(). Thus, the xdg-screensaver won't keep a useless reference to 
the X11 connection.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis


More information about the Xcb mailing list