2 ===================================================================
3 --- trunk/app.h (revision 151)
4 +++ trunk/app.h (working copy)
9 + void RestartServer();
16 void KillAllClients(Bool top);
17 - void RestartServer();
22 ===================================================================
23 --- trunk/app.cpp (revision 151)
24 +++ trunk/app.cpp (working copy)
29 +int xioerror(Display *disp) {
30 + LoginApp->RestartServer();
34 void CatchSignal(int sig) {
35 cerr << APPNAME << ": unexpected signal " << sig << endl;
36 LoginApp->StopServer();
42 -void AlarmSignal(int sig) {
43 - int pid = LoginApp->GetServerPID();
44 - if(waitpid(pid, NULL, WNOHANG) == pid) {
45 - LoginApp->StopServer();
46 - LoginApp->RemoveLock();
49 - signal(sig, AlarmSignal);
54 void User1Signal(int sig) {
55 signal(sig, User1Signal);
58 signal(SIGHUP, CatchSignal);
59 signal(SIGPIPE, CatchSignal);
60 signal(SIGUSR1, User1Signal);
61 - signal(SIGALRM, AlarmSignal);
77 + if (wpid == ServerPID)
78 + xioerror(Dpy); // Server died, simulate IO error
80 if (WIFEXITED(status) && WEXITSTATUS(status)) {
81 LoginPanel->Message("Failed to execute login command");
106 + while (waitpid(-1, NULL, WNOHANG) > 0); // Collects all dead childrens
112 for(cycles = 0; cycles < ncycles; cycles++) {
113 if((Dpy = XOpenDisplay(DisplayName))) {
114 + XSetIOErrorHandler(xioerror);
117 if(!ServerTimeout(1, "X server to begin accepting connections"))
126 // Wait for server to start up
127 if(WaitForServer() == 0) {
128 @@ -920,15 +905,12 @@
131 void App::StopServer() {
132 - // Stop alars clock and ignore signals
134 signal(SIGQUIT, SIG_IGN);
135 signal(SIGINT, SIG_IGN);
136 signal(SIGHUP, SIG_IGN);
137 signal(SIGPIPE, SIG_IGN);
138 signal(SIGTERM, SIG_DFL);
139 signal(SIGKILL, SIG_DFL);
140 - signal(SIGALRM, SIG_DFL);
143 XSetIOErrorHandler(IgnoreXIO);