]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: fix bogus errno in error message and returned value
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Mon, 18 May 2026 10:33:08 +0000 (12:33 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Mon, 18 May 2026 10:45:56 +0000 (12:45 +0200)
Reported by qarmin (Rafał Mikrut).

src/repart/repart.c

index dca90f2509e37328c03fc337bf0ed1a87a787779..133a8e02118dceaf551fa4d8b613f49427da04f8 100644 (file)
@@ -3442,8 +3442,8 @@ static int context_copy_from_one(Context *context, const char *src) {
                 if (!np->copy_blocks_path)
                         return log_oom();
 
-                np->copy_blocks_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
-                if (np->copy_blocks_fd < 0)
+                np->copy_blocks_fd = r = RET_NERRNO(fcntl(fd, F_DUPFD_CLOEXEC, 3));
+                if (r < 0)
                         return log_error_errno(r, "Failed to duplicate file descriptor of %s: %m", src);
 
                 np->copy_blocks_offset = start;