From 74ff835bfc7f95e12d04f23e07fb818ad0879b1f Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Thu, 1 May 2014 01:22:39 +0200 Subject: [PATCH] getpassword(): do not reraise SIGINT if it occurred.. as all remaining callers deal properly with a NULL return. In fact the former behaviour was not truly sane. --- extern.h | 2 +- tty.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/extern.h b/extern.h index 60c6583e..2dbae32e 100644 --- a/extern.h +++ b/extern.h @@ -1701,7 +1701,7 @@ FL bool_t yorn(char const *msg); FL char * getuser(char const *query); /* Get a password the expected way, return termios_state.ts_linebuf on - * success or NULL on error. + * success or NULL on error. SIGINT is temporarily blocked, *not* reraised. * termios_state_reset() (def.h) must be called anyway */ FL char * getpassword(char const *query); diff --git a/tty.c b/tty.c index 70f8d697..d9ae554d 100644 --- a/tty.c +++ b/tty.c @@ -182,7 +182,7 @@ yorn(char const *msg) /* TODO obsolete */ } FL char * -getuser(char const * volatile query) +getuser(char const * volatile query) /* TODO v15-compat obsolete */ { sighandler_type volatile ohdl; char *user = NULL; @@ -212,12 +212,14 @@ jrestore: } FL char * -getpassword(char const *query) /* FIXME encaps ttystate signal safe */ +getpassword(char const *query) { sighandler_type volatile ohdl; struct termios tios; char *pass = NULL; - bool_t hadsig = FAL0; +#if 0 + bool_t hadsig = FAL0; /* TODO getpassword() no longer reraises SIGINT */ +#endif NYD_ENTER; if (query == NULL) @@ -239,7 +241,9 @@ getpassword(char const *query) /* FIXME encaps ttystate signal safe */ ohdl = safe_signal(SIGINT, SIG_IGN); if (sigsetjmp(__tty_actjmp, 1) != 0) { - hadsig = TRU1; +#if 0 + hadsig = TRU1; +#endif goto jrestore; } safe_signal(SIGINT, &__tty_acthdl); @@ -253,8 +257,10 @@ jrestore: if (options & OPT_TTYIN) fputc('\n', stdout); NYD_LEAVE; +#if 0 if (hadsig && ohdl != SIG_IGN) kill(0, SIGINT); +#endif return pass; } -- 2.11.4.GIT