chiark / gitweb /
tmpfiles: remove dead branch
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 31 Jan 2015 06:03:09 +0000 (01:03 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 1 Feb 2015 17:44:04 +0000 (12:44 -0500)
In the test, p is a path to a directory, always absolute. dent->d_name
is a single path component, so they cannot be equal. The comparison
was wrong also for other reasons: D type supports globs, so direct
comparisons using streq are not enough.

src/tmpfiles/tmpfiles.c

index 473c51166b49daf368975270f9559f5a707f1357..e816bed2016114518a1ca49fa7498b5282d7fe14 100644 (file)
@@ -465,18 +465,12 @@ static int dir_cleanup(
                                 continue;
                         }
 
-                        if (i->type == IGNORE_DIRECTORY_PATH && streq(dent->d_name, p))
-                                log_debug("Ignoring directory \"%s\"", sub_path);
-                        else {
-                                log_debug("Removing directory \"%s\".", sub_path);
-
-                                if (unlinkat(dirfd(d), dent->d_name, AT_REMOVEDIR) < 0) {
-                                        if (errno != ENOENT && errno != ENOTEMPTY) {
-                                                log_error_errno(errno, "rmdir(%s): %m", sub_path);
-                                                r = -errno;
-                                        }
+                        log_debug("Removing directory \"%s\".", sub_path);
+                        if (unlinkat(dirfd(d), dent->d_name, AT_REMOVEDIR) < 0)
+                                if (errno != ENOENT && errno != ENOTEMPTY) {
+                                        log_error_errno(errno, "rmdir(%s): %m", sub_path);
+                                        r = -errno;
                                 }
-                        }
 
                 } else {
                         /* Skip files for which the sticky bit is