diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-03-16 02:55:27 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-03-16 02:55:27 +0100 |
commit | f9b72cd804f99222cf999c63eb3610a7f54bbf2c (patch) | |
tree | e59fbea3889daa91b9193f345bcd5b6bf55660a3 | |
parent | 0ac10822732008aa2c0af7a0499c838446ac0a82 (diff) |
ask-password: reset signal mask after we are done
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | src/ask-password-api.c | 12 |
2 files changed, 9 insertions, 5 deletions
@@ -26,6 +26,8 @@ F15: * recreate private socket on SIGUSR2 +* serialize condition execution information + Features: * optionally create watched directories in .path units diff --git a/src/ask-password-api.c b/src/ask-password-api.c index 0b2e9ad848..9c3dad965e 100644 --- a/src/ask-password-api.c +++ b/src/ask-password-api.c @@ -271,11 +271,15 @@ int ask_password_agent( FILE *f = NULL; char *socket_name = NULL; int socket_fd = -1, signal_fd = -1; - sigset_t mask; + sigset_t mask, oldmask; struct pollfd pollfd[_FD_MAX]; assert(_passphrases); + assert_se(sigemptyset(&mask) == 0); + sigset_add_many(&mask, SIGINT, SIGTERM, -1); + assert_se(sigprocmask(SIG_BLOCK, &mask, &oldmask) == 0); + mkdir_p("/dev/.run/systemd/ask-password", 0755); if ((fd = mkostemp(temp, O_CLOEXEC|O_CREAT|O_WRONLY)) < 0) { @@ -294,10 +298,6 @@ int ask_password_agent( fd = -1; - assert_se(sigemptyset(&mask) == 0); - sigset_add_many(&mask, SIGINT, SIGTERM, -1); - assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); - if ((signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC)) < 0) { log_error("signalfd(): %m"); r = -errno; @@ -493,6 +493,8 @@ finish: if (final[0]) unlink(final); + assert_se(sigprocmask(SIG_SETMASK, &oldmask, NULL) == 0); + return r; } |