From a8224e8e7e412470e2fe37d5060224ed98bf8284 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 16 Aug 2018 16:16:40 +0200 Subject: sulogin: restore signals after failed exec() only * removes unnecessary variable * the current code restores signals always when shell has not been executed -- this is correct as function sushell() modify signal mask, but in all another cases we do not need touch the mask. Especially when we ask for the password in endless while() loop... Signed-off-by: Karel Zak --- login-utils/sulogin.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'login-utils') diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c index 78a01f432..5f09bd48e 100644 --- a/login-utils/sulogin.c +++ b/login-utils/sulogin.c @@ -976,7 +976,7 @@ int main(int argc, char **argv) while (1) { const char *passwd = pwd->pw_passwd; const char *answer; - int failed = 0, doshell = 0; + int doshell = 0; int deny = !opt_e && locked_account_password(pwd->pw_passwd); doprompt(passwd, con, deny); @@ -999,15 +999,13 @@ int main(int argc, char **argv) } if (doshell) { + /* sushell() unmask signals */ sushell(pwd); - failed++; - } - mask_signal(SIGQUIT, SIG_IGN, &saved_sigquit); - mask_signal(SIGTSTP, SIG_IGN, &saved_sigtstp); - mask_signal(SIGINT, SIG_IGN, &saved_sigint); + mask_signal(SIGQUIT, SIG_IGN, &saved_sigquit); + mask_signal(SIGTSTP, SIG_IGN, &saved_sigtstp); + mask_signal(SIGINT, SIG_IGN, &saved_sigint); - if (failed) { fprintf(stderr, _("cannot execute su shell\n\n")); break; } -- cgit v1.2.3-55-g7522