]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: propagate clean_item_instance() error in clean_item()
authordongshengyuan <545258830@qq.com>
Mon, 29 Jun 2026 02:20:36 +0000 (10:20 +0800)
committerdongshengyuan <545258830@qq.com>
Mon, 29 Jun 2026 02:20:36 +0000 (10:20 +0800)
The CREATE_DIRECTORY, TRUNCATE_DIRECTORY, CREATE_SUBVOLUME,
CREATE_SUBVOLUME_INHERIT_QUOTA, CREATE_SUBVOLUME_NEW_QUOTA and
COPY_FILES branches in clean_item() called clean_item_instance()
but discarded its return value, always returning 0.

If dir_cleanup() fails (e.g. cannot stat a subdirectory), the error
is silently swallowed and the caller has no way to detect the failure.
The sibling EMPTY_DIRECTORY/IGNORE_PATH branches already propagate
the error correctly via glob_item().

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
src/tmpfiles/tmpfiles.c

index 738f09a9633ab2286c55073dd341203c9bc7c417..620ab9486e1ec09c4434f8350e8fc71cc5db60b7 100644 (file)
@@ -3486,8 +3486,7 @@ static int clean_item(Context *c, Item *i) {
         case CREATE_SUBVOLUME_INHERIT_QUOTA:
         case CREATE_SUBVOLUME_NEW_QUOTA:
         case COPY_FILES:
-                clean_item_instance(c, i, i->path, CREATION_EXISTING);
-                return 0;
+                return clean_item_instance(c, i, i->path, CREATION_EXISTING);
 
         case EMPTY_DIRECTORY:
         case IGNORE_PATH: