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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2015-01-31 01:03:09 -05:00
parent 0775b9b611
commit 612532206c
1 changed files with 5 additions and 11 deletions

View 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