From: Daan De Meyer Date: Wed, 22 Apr 2026 19:17:17 +0000 (+0200) Subject: repart: Fix xopenat_full() error handling X-Git-Tag: v260.2~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0d566cda3473b6af8eb82a31c33b780afd67343;p=thirdparty%2Fsystemd.git repart: Fix xopenat_full() error handling (cherry picked from commit 4114bf7e700fa2c6877230ca1199056cfbafc4e7) --- diff --git a/src/repart/repart.c b/src/repart/repart.c index c7f98a5853e..eccbaef7368 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -8715,7 +8715,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 @@ -8926,7 +8926,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) @@ -10024,7 +10024,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;