From a4b50a6f511e60a57955dab7586aba08a5c54337 Mon Sep 17 00:00:00 2001 From: Jethro Grassie Date: Thu, 1 Feb 2018 15:32:30 -0500 Subject: handle ^D and ^C while password prompting --- src/common/util.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/common/util.h') diff --git a/src/common/util.h b/src/common/util.h index 5afb42c97..d3ba47a4f 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -153,8 +153,12 @@ namespace tools } return r; #else + static struct sigaction sa; + memset(&sa, 0, sizeof(struct sigaction)); + sa.sa_handler = posix_handler; + sa.sa_flags = 0; /* Only blocks SIGINT, SIGTERM and SIGPIPE */ - signal(SIGINT, posix_handler); + sigaction(SIGINT, &sa, NULL); signal(SIGTERM, posix_handler); signal(SIGPIPE, SIG_IGN); m_handler = t; -- cgit v1.2.3