X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=getpass.c;h=3c19ba7c832fb9f3825c3b98c6d29e7cd5024351;hb=91644ff0b2e6eb3b26c5544a4a769ca4aaf08a14;hp=6e4b93cf21889576926ad8f69f30c5bee374fb41;hpb=a12da4ee65e0d140bbbcb811eef1cba93785ce35;p=~andy%2Ffetchmail diff --git a/getpass.c b/getpass.c index 6e4b93cf..3c19ba7c 100644 --- a/getpass.c +++ b/getpass.c @@ -56,13 +56,12 @@ static int ttyfd; #endif #endif -void static save_tty_state(void); -void static disable_tty_echo(void); -void static restore_tty_state(void); +static void save_tty_state(void); +static void disable_tty_echo(void); +static void restore_tty_state(void); static RETSIGTYPE sigint_handler(int); -char *fm_getpassword(prompt) -char *prompt; +char *fm_getpassword(char *prompt) { #if !(defined(HAVE_TCSETATTR) || defined(HAVE_TERMIO_H) || defined(HAVE_STTY)) #if defined(HAVE_GETPASS) @@ -77,8 +76,7 @@ char *prompt; register int c; FILE *fi; static char pbuf[INPUT_BUF_SIZE]; - RETSIGTYPE (*sig)(int) = 0; /* initialization pacifies -Wall */ - RETSIGTYPE sigint_handler(int); + SIGHANDLERTYPE sig = 0; /* initialization pacifies -Wall */ int istty = isatty(0); @@ -103,7 +101,7 @@ char *prompt; /* now that we have the current tty state, we can catch SIGINT and exit gracefully */ - sig = signal(SIGINT, sigint_handler); + sig = set_signal_handler(SIGINT, sigint_handler); /* turn off echo on the tty */ disable_tty_echo(); @@ -129,7 +127,7 @@ char *prompt; restore_tty_state(); /* restore previous state of SIGINT */ - signal(SIGINT, sig); + set_signal_handler(SIGINT, sig); } if (fi != stdin) fclose(fi); /* not checking should be safe, file mode was "r" */ @@ -190,6 +188,7 @@ static void restore_tty_state(void) static RETSIGTYPE sigint_handler(int signum) { + (void)signum; restore_tty_state(); report(stderr, GT_("\nCaught SIGINT... bailing out.\n")); exit(1);