wayland: try 50 times to create lock file again for login screen

since commit 8c16ac47c1, we started
creating the login screen on display 1024 instead of display 0.

This defeats this logic in try_display:

    display++;
    /* If display is above 50, then something's wrong. Just
     * abort in this case. */
    if (display > 50)

In practice it doesn't matter much since we only have one login
screen in most setups, but we should still fix the bug.

This commit introduces a separate counter to keep try of 50 tries,
rather than assuming "display number == number of tries".

https://bugzilla.gnome.org/show_bug.cgi?id=746545
This commit is contained in:
Ray Strode 2015-03-20 15:09:13 -04:00
parent 102fa0e373
commit a5d1f67c34

View File

@ -228,14 +228,16 @@ create_lockfile (int display, int *display_out)
char pid[11];
int size;
int number_of_tries = 0;
while (!try_display (display, &filename, &fd))
{
display++;
number_of_tries++;
/* If display is above 50, then something's wrong. Just
/* If we can't get a display after 50 times, then something's wrong. Just
* abort in this case. */
if (display > 50)
if (number_of_tries >= 50)
return NULL;
}