From 4393625a1bddded558ab72b53ec58d6f511c7809 Mon Sep 17 00:00:00 2001 From: dongshengyuan <545258830@qq.com> Date: Mon, 29 Jun 2026 10:20:36 +0800 Subject: [PATCH 1/2] tmpfiles: propagate clean_item_instance() error in clean_item() 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 --- src/tmpfiles/tmpfiles.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 738f09a963..620ab9486e 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -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: From af02a393f59520fd7069c8e4a06691b22e5b1d80 Mon Sep 17 00:00:00 2001 From: dongshengyuan <545258830@qq.com> Date: Mon, 29 Jun 2026 10:20:59 +0800 Subject: [PATCH 2/2] tmpfiles: fix device node major:minor logging to use i->major_minor The debug log after creating a device node passed major(i->mode) and minor(i->mode) to format the device number, but i->mode holds the file permission bits (e.g. 0644), not the device number. The device major:minor is stored in i->major_minor, which is also what mknodat() receives. Use that field instead so the log correctly reports the created device number. Signed-off-by: dongshengyuan --- src/tmpfiles/tmpfiles.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 620ab9486e..923c2c60f7 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -2569,10 +2569,10 @@ static int create_device( } } - log_debug("%s %s device node \"%s\" %u:%u.", + log_debug("%s %s device node \"%s\" " DEVNUM_FORMAT_STR ".", creation_mode_verb_to_string(creation), i->type == CREATE_BLOCK_DEVICE ? "block" : "char", - i->path, major(i->mode), minor(i->mode)); + i->path, DEVNUM_FORMAT_VAL(i->major_minor)); return fd_set_perms(c, i, fd, i->path, &st, creation);