From 7459ede80653fbb1ee0a689592a61ad46be7ce77 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Fri, 16 Jan 2026 16:48:36 -0500 Subject: [PATCH] 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. --- src/tmpfiles.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tmpfiles.c b/src/tmpfiles.c index 3e307162..c2badc5d 100644 --- a/src/tmpfiles.c +++ b/src/tmpfiles.c @@ -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) {