X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fask-password-api.c;h=3941605ceceda64730943f5dcee30f49af84ef32;hb=d896ac2d2fbce41a0b11a0618a685adeaf18b8fe;hp=0a61dafc59026631532478607488e3736fcd80a1;hpb=0a6f50c0afdfc434b492493bd9efab20cbee8623;p=elogind.git diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 0a61dafc5..3941605ce 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -32,9 +32,12 @@ #include #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;