From 612532206c531ab2aafd398338d5dd44cb6d3553 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 31 Jan 2015 01:03:09 -0500 Subject: [PATCH] tmpfiles: remove dead branch 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 | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 473c51166..e816bed20 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -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 -- 2.30.2