Xephyr: Remove socket and its lock file on exit

https://bugs.freedesktop.org/show_bug.cgi?id=11484

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
This commit is contained in:
Jeremy Huddleston 2011-10-10 12:16:31 -07:00
parent c13a48e74e
commit db30615bcb

View File

@ -45,6 +45,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> /* for memset */ #include <string.h> /* for memset */
#include <errno.h>
#include <time.h> #include <time.h>
#include <sys/ipc.h> #include <sys/ipc.h>
@ -331,6 +332,14 @@ hostx_set_title (char *title)
ephyrTitle = title; ephyrTitle = title;
} }
static int _X_NORETURN
x_io_error_handler (Display *dpy) {
ErrorF("Lost connection to X server: %s\n", strerror(errno));
CloseWellKnownConnections();
OsCleanup(1);
exit(1);
}
int int
hostx_init (void) hostx_init (void)
{ {
@ -358,6 +367,8 @@ hostx_init (void)
exit(1); exit(1);
} }
XSetIOErrorHandler(x_io_error_handler);
HostX.screen = DefaultScreen(HostX.dpy); HostX.screen = DefaultScreen(HostX.dpy);
HostX.winroot = RootWindow(HostX.dpy, HostX.screen); HostX.winroot = RootWindow(HostX.dpy, HostX.screen);
HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL); HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);