Is x server connection still valid?

Daniel Stone daniel at
Tue Jan 9 14:22:07 PST 2007

On Tue, Jan 09, 2007 at 04:05:17PM -0600, hugo vanwoerkom wrote:
> I hope this is the right place to ask this question:
> I have various displays and want to modify the LEDs of the keyboards
> connected to them.
> In order to do that I XOpenDisplay and see if it is successful.
> If successful I use XChangeKeyboardControl.
> But how do I find out next time I use that function that the X server
> connection is still valid?
> The user may have logged off, causing a SIGPIPE fault in using the function.
> Is there some way to find if the display structure actually still is
> for an existing connection without getting into that SIGPIPE?

Xlib's default behaviour is to just terminate your process (see
XSetIOErrorHandler, I think it is), so you're pretty safe there.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <>

More information about the xorg mailing list