aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.h
diff options
context:
space:
mode:
authorJethro Grassie <jtg@xtrabass.com>2018-02-01 15:32:30 -0500
committerJethro Grassie <jtg@xtrabass.com>2018-02-10 18:29:49 -0500
commita4b50a6f511e60a57955dab7586aba08a5c54337 (patch)
tree93a0915795456aae2eab1984d07929e8c4c12cd3 /src/common/util.h
parentMerge pull request #3198 (diff)
downloadmonero-a4b50a6f511e60a57955dab7586aba08a5c54337.tar.xz
handle ^D and ^C while password prompting
Diffstat (limited to 'src/common/util.h')
-rw-r--r--src/common/util.h6
1 files changed, 5 insertions, 1 deletions
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;