Commit a95c4e83e41eebce45d43d23b5c179d0f2a263ea

Ran Benita 2014-08-18T19:47:10

test/x11comp: server writes \n to displayfd Signed-off-by: Ran Benita <ran234@gmail.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/test/x11comp.c b/test/x11comp.c
index a8c27fe..c63c4cc 100644
--- a/test/x11comp.c
+++ b/test/x11comp.c
@@ -81,12 +81,14 @@ main(void)
     display[0] = ':';
     ret = read(pipefds[0], display + 1, sizeof(display) - 1);
     assert(ret > 0 && 1 + ret < sizeof(display) - 1);
+    if (display[ret] == '\n')
+        display[ret] = '\0';
     display[1 + ret] = '\0';
     close(pipefds[0]);
     close(pipefds[1]);
 
     conn = xcb_connect(display, NULL);
-    if (!conn || xcb_connection_has_error(conn)) {
+    if (xcb_connection_has_error(conn)) {
         ret = SKIP_TEST;
         goto err_xvfd;
     }