]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
windows: Preserve GetExitCodeProcess error
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 2 Jun 2025 21:21:26 +0000 (23:21 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 2 Jun 2025 21:21:26 +0000 (23:21 +0200)
If the waitpid version for Windows fails, preserve the error code and
avoid overwriting it with a possible CloseHandle error.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_windows.c

index 03c9736c06a2cb484a6b92d4bb570e9ddeac129f..349114a61ff3c2513e04124e605a5fa60dd35e07 100644 (file)
@@ -641,8 +641,8 @@ __la_waitpid(HANDLE child, int *status, int option)
        (void)option;/* UNUSED */
        do {
                if (GetExitCodeProcess(child, &cs) == 0) {
-                       CloseHandle(child);
                        la_dosmaperr(GetLastError());
+                       CloseHandle(child);
                        *status = 0;
                        return (-1);
                }