From 299b81181cbc959413acecd9510f31baf5de8294 Mon Sep 17 00:00:00 2001 From: slashblog <31380679+slashblog@users.noreply.github.com> Date: Sun, 27 Aug 2017 11:23:59 +0530 Subject: [PATCH 1/3] Add files via upload Fix for reboot problem --- dm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dm.c b/dm.c index b5434cc..486bcaa 100644 --- a/dm.c +++ b/dm.c @@ -145,6 +145,9 @@ static void catch_signals (int sig) static int setup_quit_notification(sigset_t* origset) { + if (quit_signal_caught) + return E_USER_QUIT; + /* Reset caught signal flag */ quit_signal_caught = 0; From 734aa3ba8ed7c38d00df0ee8f74b51844fe6ae43 Mon Sep 17 00:00:00 2001 From: slashblog <31380679+slashblog@users.noreply.github.com> Date: Sun, 27 Aug 2017 19:29:29 +0530 Subject: [PATCH 2/3] Add files via upload Fixes When systemd tries to kill nodm, nodm restarts itself instead #5 --- dm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dm.c b/dm.c index 486bcaa..b014af9 100644 --- a/dm.c +++ b/dm.c @@ -137,6 +137,7 @@ int nodm_display_manager_stop(struct nodm_display_manager* dm) } // Signal handler for wait loop +static int setup_quit_notifications_done = 0; static int quit_signal_caught = 0; static void catch_signals (int sig) { @@ -146,8 +147,12 @@ static void catch_signals (int sig) static int setup_quit_notification(sigset_t* origset) { if (quit_signal_caught) - return E_USER_QUIT; + return E_USER_QUIT; + if (setup_quit_notifications_done) + return E_SUCCESS; + + setup_quit_notifications_done = 1; /* Reset caught signal flag */ quit_signal_caught = 0; @@ -172,12 +177,6 @@ static int setup_quit_notification(sigset_t* origset) return E_SUCCESS; } -static void shutdown_quit_notification(const sigset_t* origset) -{ - if (sigprocmask(SIG_SETMASK, origset, NULL) == -1) - log_err("sigprocmask error: %m"); -} - int nodm_display_manager_wait(struct nodm_display_manager* dm, int* session_status) { int res = E_SUCCESS; @@ -230,7 +229,7 @@ int nodm_display_manager_wait(struct nodm_display_manager* dm, int* session_stat } cleanup: - shutdown_quit_notification(&origset); + //shutdown_quit_notification(&origset); return res; } @@ -355,7 +354,7 @@ static int interruptible_sleep(int seconds) } } - shutdown_quit_notification(&origset); + //shutdown_quit_notification(&origset); return res; } @@ -372,6 +371,9 @@ int nodm_display_manager_wait_restart_loop(struct nodm_display_manager* dm) time_t end = time(NULL); nodm_display_manager_stop(dm); + if (quit_signal_caught) + res = E_USER_QUIT; + switch (res) { case E_X_SERVER_DIED: @@ -379,6 +381,7 @@ int nodm_display_manager_wait_restart_loop(struct nodm_display_manager* dm) case E_SESSION_DIED: break; default: + return res; } From d48a8f6266d3f464138e0e95b65896917c35c89f Mon Sep 17 00:00:00 2001 From: slashblog <31380679+slashblog@users.noreply.github.com> Date: Sun, 27 Aug 2017 19:36:24 +0530 Subject: [PATCH 3/3] Add files via upload Fixes: When systemd tries to kill nodm, nodm restarts itself instead #5 --- dm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/dm.c b/dm.c index b014af9..eb68c42 100644 --- a/dm.c +++ b/dm.c @@ -229,7 +229,6 @@ int nodm_display_manager_wait(struct nodm_display_manager* dm, int* session_stat } cleanup: - //shutdown_quit_notification(&origset); return res; } @@ -354,7 +353,6 @@ static int interruptible_sleep(int seconds) } } - //shutdown_quit_notification(&origset); return res; }