From: Daan De Meyer Date: Tue, 13 Jun 2023 14:01:17 +0000 (+0200) Subject: rm-rf: Fix assertion X-Git-Tag: v254-rc1~219^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F28020%2Fhead;p=thirdparty%2Fsystemd.git rm-rf: Fix assertion This doesn't cover every case but cases where people try to do rm_rf(dir_fd, ".") are covered by unlinkat() simply failing. --- diff --git a/src/shared/rm-rf.c b/src/shared/rm-rf.c index 3a34281bb95..4664215e906 100644 --- a/src/shared/rm-rf.c +++ b/src/shared/rm-rf.c @@ -430,9 +430,7 @@ int rm_rf_at(int dir_fd, const char *path, RemoveFlags flags) { int fd, r, q = 0; assert(dir_fd >= 0 || dir_fd == AT_FDCWD); - - if (FLAGS_SET(flags, REMOVE_ROOT)) - assert(path && !dot_or_dot_dot(path)); /* unlinkat() does not support AT_EMPTY_PATH or "." so a path must be provided here. */ + assert(path); /* For now, don't support dropping subvols when also only dropping directories, since we can't do * this race-freely. */