]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
rm-rf: Fix assertion 28020/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 13 Jun 2023 14:01:17 +0000 (16:01 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 13 Jun 2023 14:13:49 +0000 (16:13 +0200)
This doesn't cover every case but cases where people try to do
rm_rf(dir_fd, ".") are covered by unlinkat() simply failing.

src/shared/rm-rf.c

index 3a34281bb95ba2b879f121738fbbe1c163128a40..4664215e906204123587d7b3b63e0b0f78aa5861 100644 (file)
@@ -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. */