chiark / gitweb /
everywhere: port everything to sigprocmask_many() and friends
[elogind.git] / src / shared / ask-password-api.c
index d6589a67f695c7db2aed8fc38d38115f47bf06ba..3941605ceceda64730943f5dcee30f49af84ef32 100644 (file)
@@ -21,7 +21,7 @@
 #include <stdbool.h>
 #include <termios.h>
 #include <unistd.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/inotify.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/signalfd.h>
 
 #include "util.h"
+#include "formats-util.h"
 #include "mkdir.h"
 #include "strv.h"
-
+#include "random-util.h"
+#include "terminal-util.h"
+#include "signal-util.h"
 #include "ask-password-api.h"
 
 static void backspace_chars(int ttyfd, size_t p) {
@@ -320,9 +323,9 @@ int ask_password_agent(
 
         assert(_passphrases);
 
-        assert_se(sigemptyset(&mask) == 0);
-        sigset_add_many(&mask, SIGINT, SIGTERM, -1);
-        assert_se(sigprocmask(SIG_BLOCK, &mask, &oldmask) == 0);
+        assert_se(sigemptyset(&mask) >= 0);
+        assert_se(sigset_add_many(&mask, SIGINT, SIGTERM, -1) >= 0);
+        assert_se(sigprocmask(SIG_BLOCK, &mask, &oldmask) >= 0);
 
         mkdir_p_label("/run/systemd/ask-password", 0755);
 
@@ -475,6 +478,8 @@ int ask_password_agent(
                         goto finish;
                 }
 
+                cmsg_close_all(&msghdr);
+
                 if (n <= 0) {
                         log_error("Message too short");
                         continue;