[pkg-fso-commits] [SCM] Automatic Display Manager branch, master, updated. debian/0.8-1-20-g71c15d0

Enrico Zini enrico at enricozini.org
Sat Jul 9 09:37:37 UTC 2011


The following commit has been merged in the master branch:
commit 0946e75e8fc23e92d86d3f186665afeb5ab2e49b
Merge: 2c4dcd3f6a313d5cb82eb4b24d2b487977a515a0 2ebe57e80113e2749297db59027aac821db15d5f
Author: Enrico Zini <enrico at enricozini.org>
Date:   Sat Jul 9 10:31:55 2011 +0100

    Merge branch 'master' of git://anonscm.debian.org/pkg-fso/nodm

diff --combined xserver.c
index 7f01364,78011f5..4926b63
--- a/xserver.c
+++ b/xserver.c
@@@ -62,6 -62,7 +62,7 @@@
  #include <X11/Xatom.h>
  #include <stdint.h>
  #include <stdio.h>
+ #include <setjmp.h>
  
  
  // Signal handlers
@@@ -143,17 -144,10 +144,17 @@@ int nodm_xserver_start(struct nodm_xser
          // Stop the logging subsystem before we quit via exec
          log_end();
  
 +        // don't hang on read/write to control tty (from xinit)
 +        signal(SIGTTIN, SIG_IGN);
 +        signal(SIGTTOU, SIG_IGN);
 +
          // Ignore SIGUSR1 to signal the X server that it should send us SIGUSR1
          // when ready
          signal(SIGUSR1, SIG_IGN);
  
 +        // prevent the server from getting sighup from vhangup() (from xinit)
 +        setpgid(0, getpid());
 +
          execv(srv->argv[0], (char *const*)srv->argv);
          log_err("cannot start %s: %m", srv->argv[0]);
          exit(errno == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
@@@ -240,6 -234,9 +241,9 @@@
  
      log_verb("X is ready to accept connections");
  
+     return_code = nodm_xserver_connect(srv);
+     if (return_code != E_SUCCESS) goto cleanup;
+ 
  cleanup:
      // Restore signal mask
      if (signal_mask_altered)
@@@ -258,6 -255,8 +262,8 @@@
  
  int nodm_xserver_stop(struct nodm_xserver* srv)
  {
+     nodm_xserver_disconnect(srv);
+ 
      int res = child_must_exit(srv->pid, "X server");
      srv->pid = -1;
  
@@@ -311,13 -310,26 +317,26 @@@ int nodm_xserver_connect(struct nodm_xs
      return srv->dpy == NULL ? E_X_SERVER_CONNECT : E_SUCCESS;
  }
  
+ static jmp_buf close_env;
+ static int ignorexio(Display *dpy)
+ {
+     longjmp(close_env, 1);
+     // Not reached
+     return 0;
+ }
+ 
  int nodm_xserver_disconnect(struct nodm_xserver* srv)
  {
      log_verb("disconnecting from X server");
      // TODO: get/check pending errors (how?)
      if (srv->dpy != NULL)
      {
-         XCloseDisplay(srv->dpy);
+         XSetIOErrorHandler(ignorexio);
+         if (! setjmp(close_env))
+             XCloseDisplay(srv->dpy);
+         else
+             log_warn("I/O error on display close");
+         XSetIOErrorHandler(NULL);
          srv->dpy = NULL;
      }
      return E_SUCCESS;

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list