aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-02-17 21:48:30 +0100
committerRiccardo Spagni <ric@spagni.net>2018-02-17 21:48:30 +0100
commit5a8e7fd0e5efe622aff6e5326072df767cea7ee3 (patch)
treec6726b5307c445d99954c82e1c35f899bf197301 /src/common/util.h
parentMerge pull request #3274 (diff)
parenthandle ^D and ^C while password prompting (diff)
downloadmonero-5a8e7fd0e5efe622aff6e5326072df767cea7ee3.tar.xz
Merge pull request #3249
a4b50a6f handle ^D and ^C while password prompting (Jethro Grassie)
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;