]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/kbd-util: return error on resource errors
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 4 Mar 2021 09:50:32 +0000 (10:50 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 4 Mar 2021 10:44:13 +0000 (11:44 +0100)
I guess we should still not fail on failure to access a directory and such.

src/shared/kbd-util.c

index fb98dd262e82b8fe1ca1c50ef675f6ca0556f4a2..f5669f7c03dd889c97eaeb394f2a860161f57210 100644 (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);