mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
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.
This commit is contained in:
parent
e44c5a3ba6
commit
1432d2dbdf
@ -519,8 +519,12 @@ static int watch_passwords(void) {
|
|||||||
if (notify < 0)
|
if (notify < 0)
|
||||||
return log_error_errno(errno, "Failed to allocate directory watch: %m");
|
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 (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 (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(sigemptyset(&mask) >= 0);
|
||||||
assert_se(sigset_add_many(&mask, SIGINT, SIGTERM, -1) >= 0);
|
assert_se(sigset_add_many(&mask, SIGINT, SIGTERM, -1) >= 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user