diff options
author | Jan Synacek <jsynacek@redhat.com> | 2018-10-08 15:14:38 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-11-07 15:48:43 +0100 |
commit | 1432d2dbdfa90963272a9b581dc4b55dd3ac514f (patch) | |
tree | 0771568c2563468266b764a0e6d808971636b3be /src/tty-ask-password-agent | |
parent | e44c5a3ba6cfdd0435ebc5dd9a78e404ad7a31a6 (diff) | |
download | systemd-1432d2dbdfa90963272a9b581dc4b55dd3ac514f.tar.gz |
ask-password: improve log message when inotify limit is reached
When inotify_add_watch() fails because of the inotify limit, errno is
set to ENOSPC and then gets shown to users as "No space left on device".
That is very confusing and requires in-depth knowledge of the C library.
Therefore, show user-friendly message when inotify limit is reached.
Fixes #6030.
Diffstat (limited to 'src/tty-ask-password-agent')
-rw-r--r-- | src/tty-ask-password-agent/tty-ask-password-agent.c | 8 |
1 files changed, 6 insertions, 2 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 ba2e1d37f0..1aa90b6040 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -519,8 +519,12 @@ static int watch_passwords(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) - return log_error_errno(errno, "Failed to add /run/systemd/ask-password to 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"); + } assert_se(sigemptyset(&mask) >= 0); assert_se(sigset_add_many(&mask, SIGINT, SIGTERM, -1) >= 0); |