keymap-dump: follow xkbcomp in printing affect=both in pointer actions
[platform/upstream/libxkbcommon.git] / test / x11comp.c
index 6df861a..5fd064b 100644 (file)
@@ -21,6 +21,8 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "config.h"
+
 #include <stdio.h>
 #include <spawn.h>
 #include <unistd.h>
@@ -44,10 +46,13 @@ main(void)
     char *xkb_path;
     char *original, *dump;
     char *envp[] = { NULL };
-    char *xvfb_argv[] = { "Xvfb", display, NULL };
-    pid_t xvfb_pid;
-    char *xkbcomp_argv[] = { "xkbcomp", "-I", NULL /* xkb_path */, display,
-                             NULL };
+    char *xvfb_argv[] = {
+        (char *) "Xvfb", display, NULL
+    };
+    pid_t xvfb_pid = 0;
+    char *xkbcomp_argv[] = {
+        (char *) "xkbcomp", (char *) "-I", NULL /* xkb_path */, display, NULL
+    };
     pid_t xkbcomp_pid;
 
     char *xhost = NULL;
@@ -77,8 +82,6 @@ main(void)
      * is [0, 63].
      */
     for (xdpy_candidate = 63; xdpy_candidate >= 0; xdpy_candidate--) {
-        char *buf;
-
         if (xdpy_candidate == xdpy_current) {
             continue;
         }
@@ -159,7 +162,8 @@ err_dump:
 err_xcb:
     xcb_disconnect(conn);
 err_xvfd:
-    kill(xvfb_pid, SIGTERM);
+    if (xvfb_pid > 0)
+        kill(xvfb_pid, SIGTERM);
 err_ctx:
     xkb_context_unref(ctx);
     return ret;