From: Michael Stapelberg Date: Sat, 15 Jan 2011 13:47:06 +0000 (+0100) Subject: Bugfix: correctly check for errors when connecting to X11 X-Git-Tag: 2.1~5 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3lock;a=commitdiff_plain;h=53987df490e720af98c1d079e583da5e8228d9c3 Bugfix: correctly check for errors when connecting to X11 --- diff --git a/i3lock.c b/i3lock.c index 0f77c4a..1f5e8cd 100644 --- a/i3lock.c +++ b/i3lock.c @@ -347,8 +347,9 @@ int main(int argc, char *argv[]) { errx(EXIT_FAILURE, "PAM: %s\n", pam_strerror(pam_handle, ret)); /* Initialize connection to X11 */ - if ((conn = xcb_connect(NULL, &screen)) == NULL) - err(EXIT_FAILURE, "xcb_connect()"); + if ((conn = xcb_connect(NULL, &screen)) == NULL || + xcb_connection_has_error(conn)) + errx(EXIT_FAILURE, "Could not connect to X11, maybe you need to set DISPLAY?"); if (!dont_fork) { /* In the parent process, we exit */