updated on Sat Jan 21 04:00:54 UTC 2012
[aur-mirror.git] / slim-unicode / restart.patch
blob4e5049000114ee25b9698efb34c13dac17ce3f53
1 http://developer.berlios.de/patch/?func=detailpatch&patch_id=2378&group_id=2663
4 diff -aur slim-1.3.2.b/app.cpp slim-1.3.2.c/app.cpp
5 --- slim-1.3.2.b/app.cpp 2010-08-21 15:10:48.579631179 +0200
6 +++ slim-1.3.2.c/app.cpp 2010-08-21 15:11:03.946389843 +0200
7 @@ -104,6 +104,11 @@
9 extern App* LoginApp;
11 +int xioerror(Display *disp) {
12 + LoginApp->RestartServer();
13 + return 0;
16 void CatchSignal(int sig) {
17 cerr << APPNAME << ": unexpected signal " << sig << endl;
19 @@ -114,19 +119,6 @@
20 exit(ERR_EXIT);
24 -void AlarmSignal(int sig) {
25 - int pid = LoginApp->GetServerPID();
26 - if(waitpid(pid, NULL, WNOHANG) == pid) {
27 - LoginApp->StopServer();
28 - LoginApp->RemoveLock();
29 - exit(OK_EXIT);
30 - }
31 - signal(sig, AlarmSignal);
32 - alarm(2);
36 void User1Signal(int sig) {
37 signal(sig, User1Signal);
39 @@ -277,7 +269,6 @@
40 signal(SIGHUP, CatchSignal);
41 signal(SIGPIPE, CatchSignal);
42 signal(SIGUSR1, User1Signal);
43 - signal(SIGALRM, AlarmSignal);
45 #ifndef XNEST_DEBUG
46 if (!force_nodaemon && cfg->getOption("daemon") == "yes") {
47 @@ -298,7 +289,6 @@
49 CreateServerAuth();
50 StartServer();
51 - alarm(2);
52 #endif
55 @@ -614,6 +604,8 @@
56 int status;
57 while (wpid != pid) {
58 wpid = wait(&status);
59 + if (wpid == ServerPID)
60 + xioerror(Dpy); // Server died, simulate IO error
62 if (WIFEXITED(status) && WEXITSTATUS(status)) {
63 LoginPanel->Message("Failed to execute login command");
64 @@ -659,9 +651,6 @@
67 void App::Reboot() {
68 - // Stop alarm clock
69 - alarm(0);
71 #ifdef USE_PAM
72 try{
73 pam.end();
74 @@ -684,9 +673,6 @@
77 void App::Halt() {
78 - // Stop alarm clock
79 - alarm(0);
81 #ifdef USE_PAM
82 try{
83 pam.end();
84 @@ -772,6 +758,7 @@
86 StopServer();
87 RemoveLock();
88 + while (waitpid(-1, NULL, WNOHANG) > 0); // Collects all dead childrens
89 Run();
92 @@ -842,6 +829,7 @@
94 for(cycles = 0; cycles < ncycles; cycles++) {
95 if((Dpy = XOpenDisplay(DisplayName))) {
96 + XSetIOErrorHandler(xioerror);
97 return 1;
98 } else {
99 if(!ServerTimeout(1, (char *) "X server to begin accepting connections"))
100 @@ -926,9 +914,6 @@
101 ServerPID = -1;
102 break;
104 - alarm(15);
105 - pause();
106 - alarm(0);
108 // Wait for server to start up
109 if(WaitForServer() == 0) {
110 @@ -963,15 +948,12 @@
113 void App::StopServer() {
114 - // Stop alars clock and ignore signals
115 - alarm(0);
116 signal(SIGQUIT, SIG_IGN);
117 signal(SIGINT, SIG_IGN);
118 signal(SIGHUP, SIG_IGN);
119 signal(SIGPIPE, SIG_IGN);
120 signal(SIGTERM, SIG_DFL);
121 signal(SIGKILL, SIG_DFL);
122 - signal(SIGALRM, SIG_DFL);
124 // Catch X error
125 XSetIOErrorHandler(IgnoreXIO);
126 diff -aur slim-1.3.2.b/app.h slim-1.3.2.c/app.h
127 --- slim-1.3.2.b/app.h 2010-08-21 15:10:40.499582804 +0200
128 +++ slim-1.3.2.c/app.h 2010-08-21 15:11:03.946389843 +0200
129 @@ -34,6 +34,7 @@
130 ~App();
131 void Run();
132 int GetServerPID();
133 + void RestartServer();
134 void StopServer();
136 bool serverStarted;
137 @@ -49,7 +50,6 @@
138 void Console();
139 void Exit();
140 void KillAllClients(Bool top);
141 - void RestartServer();
142 void ReadConfig();
143 void OpenLog();
144 void CloseLog();