Skip to content

Commit

Permalink
Need to re-register for SIGCHLD on Solaris.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Stone authored and mstone2001 committed Oct 1, 2023
1 parent b508070 commit 7727359
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 6 additions & 7 deletions common/os_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -3087,6 +3087,7 @@ void
g_signal_child_stop(void (*func)(int))
{
#if defined(_WIN32)
return;
#else
signal(SIGCHLD, func);
#endif
Expand Down Expand Up @@ -3380,19 +3381,17 @@ g_waitpid(int pid, int *stat_loc, int options)
#else
int rv = 0;

if (pid < 0)
{
rv = -1;
}
else
{
again:
again:
rv = waitpid(pid, stat_loc, options);
//retry EINTR.
if( rv == -1 && errno == EINTR )
{
goto again;
}

if( rv == -1 )
{
LOG(LOG_LEVEL_ERROR, "waitpid returned %s", g_get_strerror());
}

return rv;
Expand Down
7 changes: 7 additions & 0 deletions sesman/sesexec/sesexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ set_sigchld_event(int sig)
{
g_set_wait_obj(g_sigchld_event);
}

#ifdef __sun
/* On solaris we need to re-register for the signal hander. */
g_signal_child_stop(set_sigchld_event);
#endif
}

/******************************************************************************/
Expand All @@ -241,6 +246,7 @@ sesexec_terminate_main_loop(int status)
static void
process_sigchld_event(void)
{
LOG(LOG_LEVEL_TRACE, "process_sigchld_event()");
struct exit_status e;
int pid;

Expand All @@ -249,6 +255,7 @@ process_sigchld_event(void)
{
session_process_child_exit(g_session_data, pid, &e);
}
LOG(LOG_LEVEL_TRACE, "process_sigchld_event() returned");
}

/******************************************************************************/
Expand Down

0 comments on commit 7727359

Please sign in to comment.