From e5e9b048f5336e76c31dbf1cd25298c0b292891a Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Mon, 13 Feb 2017 16:46:48 +1300 Subject: Retry VT_WAITACTIVE if we get EINT --- src/vt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vt.c b/src/vt.c index 8d31f78b..32dc53f5 100644 --- a/src/vt.c +++ b/src/vt.c @@ -97,8 +97,17 @@ vt_set_active (gint number) /* Wait for the VT to become active to avoid a suspected * race condition somewhere between LightDM, X, ConsoleKit and the kernel. * See https://bugs.launchpad.net/bugs/851612 */ - if (ioctl (tty_fd, VT_WAITACTIVE) < 0) - g_warning ("Error using VT_WAITACTIVE %d on /dev/tty0: %s", n, strerror (errno)); + /* This call sometimes get interrupted (not sure what signal is causing it), so retry if that is the case */ + while (TRUE) + { + if (ioctl (tty_fd, VT_WAITACTIVE, n) < 0) + { + if (errno == EINTR) + continue; + g_warning ("Error using VT_WAITACTIVE %d on /dev/tty0: %s", n, strerror (errno)); + } + break; + } close (tty_fd); } -- cgit v1.2.1