util-linux/sulogin-fooled-on-tty-line-due-plymouth.patch
Tomáš Chvátal 9afc78f856 Accepting request 221269 from Base:System
- Add patch sulogin-does-not-find-any-console.patch to enable sulogin
  to find suitable console device even if first is not usable (bnc#862078)

- Avoid that hanging plymouth locks terminal lines that is
  add patch sulogin-fooled-on-tty-line-due-plymouth.patch and
  modify patch agetty-fooled-on-serial-line-due-plymouth.patch
  to remove any lock which had been left over.

OBS-URL: https://build.opensuse.org/request/show/221269
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/util-linux?expand=0&rev=179
2014-02-09 12:18:02 +00:00

34 lines
864 B
Diff

Make sure that plymouth does not break sulogin.
---
sulogin.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
--- login-utils/sulogin.c
+++ login-utils/sulogin.c 2014-02-06 09:39:57.726236116 +0000
@@ -83,7 +83,23 @@ static void tcinit(struct console *con)
{
int mode = 0, flags = 0;
struct termios *tio = &con->tio;
- int fd = con->fd;
+ struct termios lock;
+ int i, fd = con->fd;
+
+ for (i = 0; i < 5; i++) {
+ /*
+ * With plymouth the termios flags become changed after this
+ * function had changed the termios.
+ */
+ memset(&lock, 0, sizeof(struct termios));
+ if (ioctl(fd, TIOCGLCKTRMIOS, &lock) < 0)
+ break;
+ if (!lock.c_iflag && !lock.c_oflag && !lock.c_cflag && !lock.c_lflag)
+ break;
+ sleep(1);
+ }
+ memset(&lock, 0, sizeof(struct termios));
+ ioctl(fd, TIOCSLCKTRMIOS, &lock);
errno = 0;