[win32] Protect usage of SIGHUP with #ifdef
[platform/upstream/dbus.git] / tools / dbus-launch.c
index 6a10ffa..139d0aa 100644 (file)
@@ -402,7 +402,9 @@ signal_handler (int sig)
 {
   switch (sig)
     {
+#ifdef SIGHUP
     case SIGHUP:
+#endif
     case SIGTERM:
       got_sighup = TRUE;
       break;
@@ -458,6 +460,17 @@ kill_bus_when_session_ends (void)
   
   while (TRUE)
     {
+#ifdef DBUS_BUILD_X11
+      /* Dump events on the floor, and let
+       * IO error handler run if we lose
+       * the X connection. It's important to
+       * run this before going into select() since
+       * we might have queued outgoing messages or
+       * events.
+       */
+      x11_handle_event ();
+#endif
+      
       FD_ZERO (&read_set);
       FD_ZERO (&err_set);
 
@@ -472,7 +485,7 @@ kill_bus_when_session_ends (void)
           FD_SET (x_fd, &read_set);
           FD_SET (x_fd, &err_set);
         }
-      
+
       select (MAX (tty_fd, x_fd) + 1,
               &read_set, NULL, &err_set, NULL);
 
@@ -483,15 +496,12 @@ kill_bus_when_session_ends (void)
         }
       
 #ifdef DBUS_BUILD_X11
-      /* Dump events on the floor, and let
-       * IO error handler run if we lose
-       * the X connection
+      /* Events will be processed before we select again
        */
       if (x_fd >= 0)
         verbose ("X fd condition reading = %d error = %d\n",
                  FD_ISSET (x_fd, &read_set),
                  FD_ISSET (x_fd, &err_set));
-      x11_handle_event ();
 #endif
 
       if (tty_fd >= 0)