shared/kbd-util: return error on resource errors

I guess we should still not fail on failure to access a directory and such.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-03-04 11:44:13 +01:00
parent 3864b4b038
commit 1d230090c3
+8 -2
View File
@@ -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);