Commit | Line | Data |
---|---|---|
f9ec07a9 LC |
1 | This patch fixes SLiM so it really waits for the X server to be ready |
2 | before attempting to connect to it. Indeed, the X server notices that | |
3 | its parent process has a handler for SIGUSR1, and consequently sends it | |
4 | SIGUSR1 when it's ready to accept connections. | |
5 | ||
6 | The problem was that SLiM doesn't pay attention to SIGUSR1. So in practice, | |
7 | if X starts slowly, then SLiM gets ECONNREFUSED a couple of time on | |
8 | /tmp/.X11-unix/X0, then goes on trying to connect to localhost:6000, | |
9 | where nobody answers; eventually, it times out and tries again on | |
10 | /tmp/.X11-unix/X0, and finally it shows up on the screen. | |
11 | ||
12 | Patch by L. Courtès. | |
13 | ||
14 | --- slim-1.3.6/app.cpp 2014-02-05 15:27:20.000000000 +0100 | |
15 | +++ slim-1.3.6/app.cpp 2014-02-09 22:42:04.000000000 +0100 | |
16 | @@ -119,7 +119,9 @@ void CatchSignal(int sig) { | |
17 | exit(ERR_EXIT); | |
18 | } | |
19 | ||
20 | +static volatile int got_sigusr1 = 0; | |
21 | void User1Signal(int sig) { | |
22 | + got_sigusr1 = 1; | |
23 | signal(sig, User1Signal); | |
24 | } | |
25 | ||
26 | @@ -884,6 +886,7 @@ int App::WaitForServer() { | |
27 | int ncycles = 120; | |
28 | int cycles; | |
29 | ||
30 | + while (!got_sigusr1); | |
31 | for(cycles = 0; cycles < ncycles; cycles++) { | |
32 | if((Dpy = XOpenDisplay(DisplayName))) { | |
33 | XSetIOErrorHandler(xioerror); |