chiark / gitweb /
conf_files_list(): files-add() - do not canonicalize file names
authorKay Sievers <kay@vrfy.org>
Mon, 7 May 2012 11:15:25 +0000 (13:15 +0200)
committerKay Sievers <kay@vrfy.org>
Mon, 7 May 2012 11:15:25 +0000 (13:15 +0200)
File names in /etc, /run, /usr/lib are sorted/overridden by basename.
Sorting things like "/dev/null" with the basename "null" in the hash
of config files breaks the ordering and the overriding logic.

src/shared/util.c

index fd2c5b075f77649f943ccf4cb59d02a3fc673e9d..d86df17591af379453b31af2b36890842b8c49e3 100644 (file)
@@ -4877,7 +4877,7 @@ static int files_add(Hashmap *h, const char *path, const char *suffix) {
 
         for (;;) {
                 int k;
 
         for (;;) {
                 int k;
-                char *p, *f;
+                char *p;
 
                 k = readdir_r(dir, &buffer, &de);
                 if (k != 0) {
 
                 k = readdir_r(dir, &buffer, &de);
                 if (k != 0) {
@@ -4896,17 +4896,10 @@ static int files_add(Hashmap *h, const char *path, const char *suffix) {
                         goto finish;
                 }
 
                         goto finish;
                 }
 
-                f = canonicalize_file_name(p);
-                if (!f) {
-                        log_error("Failed to canonicalize file name '%s': %m", p);
+                if (hashmap_put(h, file_name_from_path(p), p) <= 0) {
+                        log_debug("Skip overridden file: %s.", p);
                         free(p);
                         free(p);
-                        continue;
                 }
                 }
-                free(p);
-
-                log_debug("found: %s\n", f);
-                if (hashmap_put(h, file_name_from_path(f), f) <= 0)
-                        free(f);
         }
 
 finish:
         }
 
 finish: