]> git.sur5r.net Git - i3/i3lock/commitdiff
Bugfix: correctly check for errors when connecting to X11
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 15 Jan 2011 13:47:06 +0000 (14:47 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 15 Jan 2011 13:47:06 +0000 (14:47 +0100)
i3lock.c

index 0f77c4a2dc86a68251deb2c9bed9176ff0179875..1f5e8cd367e78aec12dd0d17e85b7f967ca3677a 100644 (file)
--- 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 */