Restore previous SIGCHLD handler in serverPause().

This fixes the issue where xenodm whould stay stuck after kill the
Xserver twice.

While here add some more Debug() calls to help following what's going on
This commit is contained in:
matthieu 2018-07-11 14:35:46 +00:00
parent 323f3c34c5
commit 8f540c071b

View File

@ -157,8 +157,10 @@ serverPause (unsigned t, pid_t serverPid)
struct timespec timeout; struct timespec timeout;
sigset_t mask; sigset_t mask;
int result; int result;
pid_t pid; pid_t pid;
void (*old)(int);
Debug("serverPause\n");
serverPauseRet = false; serverPauseRet = false;
for (;;) { for (;;) {
@ -166,7 +168,7 @@ serverPause (unsigned t, pid_t serverPid)
timeout.tv_nsec = 0; timeout.tv_nsec = 0;
/* setup a SIGCHLD handler, to interrupt ppoll() below */ /* setup a SIGCHLD handler, to interrupt ppoll() below */
signal(SIGCHLD, chldHandler); old = signal(SIGCHLD, chldHandler);
/* unblock all signals*/ /* unblock all signals*/
sigemptyset(&mask); sigemptyset(&mask);
if (!receivedUsr1) { if (!receivedUsr1) {
@ -189,7 +191,7 @@ serverPause (unsigned t, pid_t serverPid)
break; break;
} }
} }
signal(SIGCHLD, SIG_DFL); signal(SIGCHLD, old);
if (serverPauseRet) { if (serverPauseRet) {
Debug ("Server died\n"); Debug ("Server died\n");
LogError ("server unexpectedly died\n"); LogError ("server unexpectedly died\n");
@ -235,6 +237,7 @@ WaitForServer (struct display *d)
void void
ResetServer (struct display *d) ResetServer (struct display *d)
{ {
Debug("ResetServer");
if (d->dpy) if (d->dpy)
pseudoReset (d->dpy); pseudoReset (d->dpy);
} }