summaryrefslogtreecommitdiffstats
path: root/login-utils/sulogin.c
diff options
context:
space:
mode:
authorWerner Fink2016-04-22 12:16:04 +0200
committerKarel Zak2016-05-20 11:21:10 +0200
commitfe3f7e17aad40d2e0e16fb2102ea4980589ee412 (patch)
tree247df3e9dca17e620a643dbf606f674fef19383d /login-utils/sulogin.c
parentMerge branch 'cal04' (diff)
downloadkernel-qcow2-util-linux-fe3f7e17aad40d2e0e16fb2102ea4980589ee412.tar.gz
kernel-qcow2-util-linux-fe3f7e17aad40d2e0e16fb2102ea4980589ee412.tar.xz
kernel-qcow2-util-linux-fe3f7e17aad40d2e0e16fb2102ea4980589ee412.zip
sulogin: agetty: use the plymouth local protocol instead the plymouth binary
for stopping plymouthd. That do not depend on the existence of the plymouth binary if it e.g. becomes uninstalled or an other service is providing plymouthd facilities. [kzak@redhat.com: - fix compiler warnings [-Wpointer-sign] - use sizeof() for write_all() - cast to char* for read_all] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/sulogin.c')
-rw-r--r--login-utils/sulogin.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 601d38caf..8d6e65229 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -58,6 +58,7 @@
#include "closestream.h"
#include "nls.h"
#include "pathnames.h"
+#include "plymouth-ctrl.h"
#include "strutils.h"
#include "ttyutils.h"
#include "sulogin-consoles.h"
@@ -92,42 +93,6 @@ static int locked_account_password(const char *passwd)
return 0;
}
-#ifdef TIOCGLCKTRMIOS
-/*
- * For the case plymouth is found on this system
- */
-static int plymouth_command(const char* arg)
-{
- const char *cmd = "/usr/bin/plymouth";
- static int has_plymouth = 1;
- pid_t pid;
-
- if (!has_plymouth)
- return 127;
-
- pid = fork();
- if (!pid) {
- int fd = open("/dev/null", O_RDWR);
- if (fd < 0)
- exit(127);
- dup2(fd, 0);
- dup2(fd, 1);
- dup2(fd, 2);
- if (fd > 2)
- close(fd);
- execl(cmd, cmd, arg, (char *) NULL);
- exit(127);
- } else if (pid > 0) {
- int status;
- waitpid(pid, &status, 0);
- if (status == 127)
- has_plymouth = 0;
- return status;
- }
- return 1;
-}
-#endif
-
/*
* Fix the tty modes and set reasonable defaults.
*/
@@ -138,8 +103,9 @@ static void tcinit(struct console *con)
struct termios lock;
int fd = con->fd;
#ifdef TIOCGLCKTRMIOS
- int i = (plymouth_command("--ping")) ? 20 : 0;
-
+ int i = (plymouth_command(MAGIC_PING)) ? PLYMOUTH_TERMIOS_FLAGS_DELAY : 0;
+ if (i)
+ plymouth_command(MAGIC_QUIT);
while (i-- > 0) {
/*
* With plymouth the termios flags become changed after this
@@ -150,8 +116,6 @@ static void tcinit(struct console *con)
break;
if (!lock.c_iflag && !lock.c_oflag && !lock.c_cflag && !lock.c_lflag)
break;
- if (i == 15 && plymouth_command("quit") != 0)
- break;
sleep(1);
}
memset(&lock, 0, sizeof(struct termios));