771b4bc
From 9a297a418295f27917ab6796236ab939ea0a43f9 Mon Sep 17 00:00:00 2001
771b4bc
From: Kay Sievers <kay@vrfy.org>
771b4bc
Date: Mon, 7 May 2012 13:15:25 +0200
771b4bc
Subject: [PATCH] conf_files_list(): files-add() - do not canonicalize file
771b4bc
 names
771b4bc
771b4bc
File names in /etc, /run, /usr/lib are sorted/overridden by basename.
771b4bc
Sorting things like "/dev/null" with the basename "null" in the hash
771b4bc
of config files breaks the ordering and the overriding logic.
771b4bc
(cherry picked from commit cd9556cc84523e2d515a8be2648e2a50fb6b2144)
771b4bc
---
771b4bc
 src/shared/util.c |   13 +++----------
771b4bc
 1 file changed, 3 insertions(+), 10 deletions(-)
771b4bc
771b4bc
diff --git a/src/shared/util.c b/src/shared/util.c
771b4bc
index 283d0c5..07d8892 100644
771b4bc
--- a/src/shared/util.c
771b4bc
+++ b/src/shared/util.c
771b4bc
@@ -4877,7 +4877,7 @@ static int files_add(Hashmap *h, const char *path, const char *suffix) {
771b4bc
 
771b4bc
         for (;;) {
771b4bc
                 int k;
771b4bc
-                char *p, *f;
771b4bc
+                char *p;
771b4bc
 
771b4bc
                 k = readdir_r(dir, &buffer, &de);
771b4bc
                 if (k != 0) {
771b4bc
@@ -4896,17 +4896,10 @@ static int files_add(Hashmap *h, const char *path, const char *suffix) {
771b4bc
                         goto finish;
771b4bc
                 }
771b4bc
 
771b4bc
-                f = canonicalize_file_name(p);
771b4bc
-                if (!f) {
771b4bc
-                        log_error("Failed to canonicalize file name '%s': %m", p);
771b4bc
+                if (hashmap_put(h, file_name_from_path(p), p) <= 0) {
771b4bc
+                        log_debug("Skip overridden file: %s.", p);
771b4bc
                         free(p);
771b4bc
-                        continue;
771b4bc
                 }
771b4bc
-                free(p);
771b4bc
-
771b4bc
-                log_debug("found: %s\n", f);
771b4bc
-                if (hashmap_put(h, file_name_from_path(f), f) <= 0)
771b4bc
-                        free(f);
771b4bc
         }
771b4bc
 
771b4bc
 finish: