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

Enrico Zini enrico at enricozini.org
Fri Jul 8 17:47:15 UTC 2011


The following commit has been merged in the master branch:
commit a30dbc0bd28ba7ced956abf5bb788cdc472eb375
Author: Enrico Zini <enrico at enricozini.org>
Date:   Fri Jul 8 19:47:10 2011 +0200

    Better server and session quit report

diff --git a/dm.c b/dm.c
index adbcb5e..0a54d13 100644
--- a/dm.c
+++ b/dm.c
@@ -170,7 +170,6 @@ static void shutdown_quit_notification(const sigset_t* origset)
         log_err("sigprocmask error: %m");
 }
 
-
 int nodm_display_manager_wait(struct nodm_display_manager* dm, int* session_status)
 {
     int res = E_SUCCESS;
@@ -210,12 +209,12 @@ int nodm_display_manager_wait(struct nodm_display_manager* dm, int* session_stat
         if (child == dm->srv.pid)
         {
             // Server died
-            log_warn("X server died with status %d", status);
+            nodm_xserver_report_exit(&dm->srv, status);
             res = E_X_SERVER_DIED;
             goto cleanup;
         } else if (child == dm->session.pid) {
             // Session died
-            log_warn("X session died with status %d", status);
+            nodm_xsession_report_exit(&dm->session, status);
             *session_status = status;
             res = E_SESSION_DIED;
             goto cleanup;
diff --git a/xserver.c b/xserver.c
index 2829c5b..ff0ed4f 100644
--- a/xserver.c
+++ b/xserver.c
@@ -192,14 +192,7 @@ int nodm_xserver_start(struct nodm_xserver* srv)
         }
         if (res == srv->pid)
         {
-            if (WIFEXITED(status))
-                log_err("X server exited with status=%d", WEXITSTATUS(status));
-            else if (WIFSIGNALED(status))
-                log_err("X server killed by signal %d", WTERMSIG(status));
-            else 
-                // This should never happen, but it's better to have a message
-                // than to fail silently through an open code path
-                log_err("X server quit, waitpid gave unrecognised status=%d", status);
+            nodm_xserver_report_exit(srv, status);
             srv->pid = -1;
             return_code = E_X_SERVER_DIED;
             goto cleanup;
@@ -393,3 +386,13 @@ void nodm_xserver_dump_status(struct nodm_xserver* srv)
     fprintf(stderr, "xserver PID: %d\n", (int)srv->pid);
     fprintf(stderr, "xserver connected: %s\n", (srv->dpy != NULL) ? "yes" : "no");
 }
+
+void nodm_xserver_report_exit(struct nodm_xserver* s, int status)
+{
+    if (WIFEXITED(status))
+        log_warn("X session quit with status %d", WEXITSTATUS(status));
+    else if (WIFSIGNALED(status))
+        log_err("X session was killed with signal %d", WTERMSIG(status));
+    else
+        log_err("X session terminated with unknown status %d", status);
+}
diff --git a/xserver.h b/xserver.h
index efddcc2..66c7372 100644
--- a/xserver.h
+++ b/xserver.h
@@ -96,4 +96,7 @@ int nodm_xserver_disconnect(struct nodm_xserver* srv);
  */
 int nodm_xserver_read_window_path(struct nodm_xserver* srv);
 
+/// Report that the X session has quit
+void nodm_xserver_report_exit(struct nodm_xserver* s, int status);
+
 #endif
diff --git a/xsession.c b/xsession.c
index 9f6acf5..7d9ae1c 100644
--- a/xsession.c
+++ b/xsession.c
@@ -149,3 +149,13 @@ void nodm_xsession_dump_status(struct nodm_xsession* s)
     fprintf(stderr, "xsession pid: %d\n", (int)s->pid);
     fprintf(stderr, "xsession body overridden by test: %s\n", (s->child_body != NULL) ? "yes" : "no");
 }
+
+void nodm_xsession_report_exit(struct nodm_xsession* s, int status)
+{
+    if (WIFEXITED(status))
+        log_warn("X session quit with status %d", WEXITSTATUS(status));
+    else if (WIFSIGNALED(status))
+        log_warn("X session was killed with signal %d", WTERMSIG(status));
+    else
+        log_warn("X session terminated with unknown status %d", status);
+}
diff --git a/xsession.h b/xsession.h
index b095d8e..309a304 100644
--- a/xsession.h
+++ b/xsession.h
@@ -68,4 +68,7 @@ int nodm_xsession_stop(struct nodm_xsession* s);
 /// Dump all internal status to stderr
 void nodm_xsession_dump_status(struct nodm_xsession* s);
 
+/// Report that the X session has quit
+void nodm_xsession_report_exit(struct nodm_xsession* s, int status);
+
 #endif

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list