diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-03-04 10:50:32 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-03-04 11:44:13 +0100 |
commit | 1d230090c3545cfbc40f2377a22c11c383d56d45 (patch) | |
tree | 67dcb4fd6604c735a6acca9e407e6497994396b2 /src/shared/kbd-util.c | |
parent | shared/kbd-util: fix return value confusion with nftw() (diff) | |
download | systemd-1d230090c3545cfbc40f2377a22c11c383d56d45.tar.xz systemd-1d230090c3545cfbc40f2377a22c11c383d56d45.zip |
shared/kbd-util: return error on resource errors
I guess we should still not fail on failure to access a directory and such.
Diffstat (limited to 'src/shared/kbd-util.c')
-rw-r--r-- | src/shared/kbd-util.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/shared/kbd-util.c b/src/shared/kbd-util.c index fb98dd262e..f5669f7c03 100644 --- a/src/shared/kbd-util.c +++ b/src/shared/kbd-util.c @@ -2,6 +2,7 @@ #include <ftw.h> +#include "errno-util.h" #include "kbd-util.h" #include "log.h" #include "nulstr-util.h" @@ -62,8 +63,13 @@ int get_keymaps(char ***ret) { const char *dir; NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS) if (nftw(dir, nftw_cb, 20, FTW_PHYS) < 0) { - if (errno != ENOENT) - log_debug_errno(errno, "Failed to read keymap list from %s, ignoring: %m", dir); + if (errno == ENOENT) + continue; + if (ERRNO_IS_RESOURCE(errno)) { + keymaps = set_free_free(keymaps); + return log_warning_errno(errno, "Failed to read keymap list from %s: %m", dir); + } + log_debug_errno(errno, "Failed to read keymap list from %s, ignoring: %m", dir); } _cleanup_strv_free_ char **l = set_get_strv(keymaps); |