tmpfiles: fix L+ to replace non-directory entries

The L+ type should replace existing entries with a symlink. Previously,
rmrf() was always called which is only appropriate for directories.
Now we check if the path is a directory first, and use erase() for
files and symlinks.
This commit is contained in:
Aaron Andersen
2026-01-18 18:59:20 -05:00
parent 6bf35513c3
commit 7459ede806
+4 -1
View File
@@ -568,7 +568,10 @@ static void tmpfiles(char *line)
if (!strc) {
if (type[1] != '+')
break;
rmrf(path);
if (fisdir(path))
rmrf(path);
else
erase(path);
}
mkparent(path, 0755);
if (!arg) {