diff options
Diffstat (limited to 'src/tty-ask-password-agent/tty-ask-password-agent.c')
-rw-r--r-- | src/tty-ask-password-agent/tty-ask-password-agent.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index 0553abca64..f57f0ec261 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -11,7 +11,6 @@ #include <stdbool.h> #include <stddef.h> #include <string.h> -#include <sys/inotify.h> #include <sys/prctl.h> #include <sys/signalfd.h> #include <sys/socket.h> @@ -29,6 +28,7 @@ #include "exit-status.h" #include "fd-util.h" #include "fileio.h" +#include "fs-util.h" #include "hashmap.h" #include "io-util.h" #include "macro.h" @@ -510,12 +510,9 @@ static int process_and_watch_password_files(void) { if (notify < 0) return log_error_errno(errno, "Failed to allocate directory watch: %m"); - if (inotify_add_watch(notify, "/run/systemd/ask-password", IN_CLOSE_WRITE|IN_MOVED_TO) < 0) { - if (errno == ENOSPC) - return log_error_errno(errno, "Failed to add /run/systemd/ask-password to directory watch: inotify watch limit reached"); - else - return log_error_errno(errno, "Failed to add /run/systemd/ask-password to directory watch: %m"); - } + r = inotify_add_watch_and_warn(notify, "/run/systemd/ask-password", IN_CLOSE_WRITE|IN_MOVED_TO); + if (r < 0) + return r; assert_se(sigemptyset(&mask) >= 0); assert_se(sigset_add_many(&mask, SIGINT, SIGTERM, -1) >= 0); |