]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Fix xopenat_full() error handling
authorDaan De Meyer <daan@amutable.com>
Wed, 22 Apr 2026 19:17:17 +0000 (21:17 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 23 Apr 2026 04:41:26 +0000 (06:41 +0200)
src/repart/repart.c

index e307bfe13f280f3fc7331237c78b44fd6cef1d9a..e91d32ef0b9d213f640db9346e01b57529d518e8 100644 (file)
@@ -9227,7 +9227,7 @@ static int context_minimize(Context *context) {
                                 attrs & FS_NOCOW_FL ? XO_NOCOW : 0,
                                 0600);
                 if (fd < 0)
-                        return log_error_errno(errno, "Failed to open temporary file %s: %m", temp);
+                        return log_error_errno(fd, "Failed to open temporary file %s: %m", temp);
 
                 if (fstype_is_ro(p->format) || is_btrfs)
                         /* Read-only filesystems and btrfs (with mkfs.btrfs --shrink) produce a minimal
@@ -9441,7 +9441,7 @@ static int context_minimize(Context *context) {
                                 attrs & FS_NOCOW_FL ? XO_NOCOW : 0,
                                 0600);
                 if (fd < 0)
-                        return log_error_errno(errno, "Failed to open temporary file %s: %m", temp);
+                        return log_error_errno(fd, "Failed to open temporary file %s: %m", temp);
 
                 r = partition_format_verity_hash(context, p, temp, dp->copy_blocks_path);
                 if (r < 0)
@@ -10604,7 +10604,7 @@ static int find_root(Context *context) {
 
                         fd = xopenat_full(AT_FDCWD, arg_node, O_RDONLY|O_CREAT|O_EXCL|O_CLOEXEC|O_NOFOLLOW, XO_NOCOW, 0666);
                         if (fd < 0)
-                                return log_error_errno(errno, "Failed to create '%s': %m", arg_node);
+                                return log_error_errno(fd, "Failed to create '%s': %m", arg_node);
 
                         context->node = TAKE_PTR(s);
                         context->node_is_our_file = true;