From 9be74cac45fa878c7797ea301c6279f8273ea1ec Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 27 Mar 2012 12:41:28 -0400 Subject: [PATCH] If there is nothing to read from the askpass program, set errno to EINTR. This makes the cancel button behave like the user entered ^C at the password prompt when PAM is used. --- src/tgetpass.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tgetpass.c b/src/tgetpass.c index c19e83b9c..8b12bdc8e 100644 --- a/src/tgetpass.c +++ b/src/tgetpass.c @@ -254,6 +254,9 @@ sudo_askpass(const char *askpass, const char *prompt) (void) close(pfd[0]); (void) sigaction(SIGPIPE, &saved_sa_pipe, NULL); + if (pass == NULL) + errno = EINTR; /* make cancel button simulate ^C */ + debug_return_str_masked(pass); } -- 2.40.0