#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 "ask-password-api.h"
assert(name);
fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
- if (fd < 0) {
- log_error_errno(errno, "socket() failed: %m");
- return -errno;
- }
+ if (fd < 0)
+ return log_error_errno(errno, "socket() failed: %m");
snprintf(sa.un.sun_path, sizeof(sa.un.sun_path)-1, "/run/systemd/ask-password/sck.%" PRIx64, random_u64());
goto finish;
}
+ cmsg_close_all(&msghdr);
+
if (n <= 0) {
log_error("Message too short");
continue;