diff options
author | Karel Zak | 2018-08-16 16:16:40 +0200 |
---|---|---|
committer | Karel Zak | 2018-08-16 16:16:40 +0200 |
commit | a8224e8e7e412470e2fe37d5060224ed98bf8284 (patch) | |
tree | c502d33dfe31ec05343a090d3d4ff5f0263cbf52 /login-utils | |
parent | sulogin: do not use plain 0 as NULL (diff) | |
download | kernel-qcow2-util-linux-a8224e8e7e412470e2fe37d5060224ed98bf8284.tar.gz kernel-qcow2-util-linux-a8224e8e7e412470e2fe37d5060224ed98bf8284.tar.xz kernel-qcow2-util-linux-a8224e8e7e412470e2fe37d5060224ed98bf8284.zip |
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 <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/sulogin.c | 12 |
1 files changed, 5 insertions, 7 deletions
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; } |