diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2011-01-15 14:47:06 +0100 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2011-01-15 14:47:06 +0100 |
commit | 53987df490e720af98c1d079e583da5e8228d9c3 (patch) | |
tree | 6b8eb09f636de47b73be735e9065fbb73eb4eeb1 /i3lock.c | |
parent | 7ba6f073221c11cb6c6bee434b9b3456d6f73074 (diff) |
Bugfix: correctly check for errors when connecting to X11
Diffstat (limited to 'i3lock.c')
-rw-r--r-- | i3lock.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 */ |