Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ of least surprise. This is what is offered:
- nodm performs VT allocation, looking for a free virtual terminal in which to
run X and keeping it allocated across X restarts.
- X is started (by default, /usr/bin/X)
- once the X esrver is ready to accept connections, the X session is set up:
- once the X server is ready to accept connections, the X session is set up:
- the DISPLAY and WINDOWPATH environment variables are set
- the session is wrapped in a PAM session, which sets up the user
environment
Expand Down
20 changes: 12 additions & 8 deletions dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -145,6 +146,13 @@ static void catch_signals (int sig)

static int setup_quit_notification(sigset_t* origset)
{
if (quit_signal_caught)
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;

Expand All @@ -169,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;
Expand Down Expand Up @@ -227,7 +229,6 @@ int nodm_display_manager_wait(struct nodm_display_manager* dm, int* session_stat
}

cleanup:
shutdown_quit_notification(&origset);
return res;
}

Expand Down Expand Up @@ -352,7 +353,6 @@ static int interruptible_sleep(int seconds)
}
}

shutdown_quit_notification(&origset);
return res;
}

Expand All @@ -369,13 +369,17 @@ 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:
break;
case E_SESSION_DIED:
break;
default:

return res;
}

Expand Down