aboutsummaryrefslogtreecommitdiff
path: root/lib/password.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-10-10 05:26:02 -0500
committerRob Landley <rob@landley.net>2018-10-10 05:26:02 -0500
commitc276b8a8c2a5181558b976b9cb1d60a0180d560e (patch)
treef2f6cd6bff76573b2a94ade1d0cdadce654a323a /lib/password.c
parent1f73aace0feb60ce1b200e7bf8e8339c1e2994fa (diff)
downloadtoybox-c276b8a8c2a5181558b976b9cb1d60a0180d560e.tar.gz
Add xsignal_flags() and more consistently use xsignal() instead of signal().
xsignal() wraps sigaction() giving control of SA_RESTART behavior and such.
Diffstat (limited to 'lib/password.c')
-rw-r--r--lib/password.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/password.c b/lib/password.c
index a02bc542..b9cc1346 100644
--- a/lib/password.c
+++ b/lib/password.c
@@ -53,7 +53,8 @@ int read_password(char *buf, int buflen, char *mesg)
struct sigaction sa, oldsa;
int i, ret = 1;
- // NOP signal handler to return from the read
+ // NOP signal handler to return from the read. Use sigaction() instead
+ // of xsignal() because we want to restore the old handler afterwards.
memset(&sa, 0, sizeof(sa));
sa.sa_handler = generic_signal;
sigaction(SIGINT, &sa, &oldsa);