updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / slim-plus / slim-restart.patch
blob1f9c02dfff76c0b227d3bc83f93b3394e4f274cc
1 diff -ur slim-1.3.1.orig/app.cpp slim-1.3.1/app.cpp
2 --- slim-1.3.1.orig/app.cpp 2008-09-26 02:54:15.000000000 +0200
3 +++ slim-1.3.1/app.cpp 2008-11-21 20:38:48.000000000 +0100
4 @@ -102,6 +102,11 @@
6 extern App* LoginApp;
8 +int xioerror(Display *disp) {
9 + LoginApp->RestartServer();
10 + return 0;
13 void CatchSignal(int sig) {
14 cerr << APPNAME << ": unexpected signal " << sig << endl;
15 LoginApp->StopServer();
16 @@ -109,19 +114,6 @@
17 exit(ERR_EXIT);
21 -void AlarmSignal(int sig) {
22 - int pid = LoginApp->GetServerPID();
23 - if(waitpid(pid, NULL, WNOHANG) == pid) {
24 - LoginApp->StopServer();
25 - LoginApp->RemoveLock();
26 - exit(OK_EXIT);
27 - }
28 - signal(sig, AlarmSignal);
29 - alarm(2);
33 void User1Signal(int sig) {
34 signal(sig, User1Signal);
36 @@ -267,7 +259,6 @@
37 signal(SIGHUP, CatchSignal);
38 signal(SIGPIPE, CatchSignal);
39 signal(SIGUSR1, User1Signal);
40 - signal(SIGALRM, AlarmSignal);
42 #ifndef XNEST_DEBUG
43 OpenLog();
44 @@ -287,7 +278,6 @@
46 CreateServerAuth();
47 StartServer();
48 - alarm(2);
49 #endif
52 @@ -603,6 +593,8 @@
53 int status;
54 while (wpid != pid) {
55 wpid = wait(&status);
56 + if (wpid == ServerPID)
57 + xioerror(Dpy); // Server died, simulate IO error
59 if (WIFEXITED(status) && WEXITSTATUS(status)) {
60 LoginPanel->Message("Failed to execute login command");
61 @@ -648,9 +640,6 @@
64 void App::Reboot() {
65 - // Stop alarm clock
66 - alarm(0);
68 #ifdef USE_PAM
69 try{
70 pam.end();
71 @@ -673,9 +662,6 @@
74 void App::Halt() {
75 - // Stop alarm clock
76 - alarm(0);
78 #ifdef USE_PAM
79 try{
80 pam.end();
81 @@ -761,6 +747,7 @@
83 StopServer();
84 RemoveLock();
85 + while (waitpid(-1, NULL, WNOHANG) > 0); // Collects all dead childrens
86 Run();
89 @@ -831,6 +818,7 @@
91 for(cycles = 0; cycles < ncycles; cycles++) {
92 if((Dpy = XOpenDisplay(DisplayName))) {
93 + XSetIOErrorHandler(xioerror);
94 return 1;
95 } else {
96 if(!ServerTimeout(1, (char *) "X server to begin accepting connections"))
97 @@ -913,9 +901,6 @@
98 ServerPID = -1;
99 break;
101 - alarm(15);
102 - pause();
103 - alarm(0);
105 // Wait for server to start up
106 if(WaitForServer() == 0) {
107 @@ -948,15 +933,12 @@
110 void App::StopServer() {
111 - // Stop alars clock and ignore signals
112 - alarm(0);
113 signal(SIGQUIT, SIG_IGN);
114 signal(SIGINT, SIG_IGN);
115 signal(SIGHUP, SIG_IGN);
116 signal(SIGPIPE, SIG_IGN);
117 signal(SIGTERM, SIG_DFL);
118 signal(SIGKILL, SIG_DFL);
119 - signal(SIGALRM, SIG_DFL);
121 // Catch X error
122 XSetIOErrorHandler(IgnoreXIO);
123 diff -ur slim-1.3.1.orig/app.h slim-1.3.1/app.h
124 --- slim-1.3.1.orig/app.h 2008-09-26 02:54:15.000000000 +0200
125 +++ slim-1.3.1/app.h 2008-11-21 20:38:48.000000000 +0100
126 @@ -34,6 +34,7 @@
127 ~App();
128 void Run();
129 int GetServerPID();
130 + void RestartServer();
131 void StopServer();
133 // Lock functions
134 @@ -48,7 +49,6 @@
135 void Console();
136 void Exit();
137 void KillAllClients(Bool top);
138 - void RestartServer();
139 void ReadConfig();
140 void OpenLog();
141 void CloseLog();