]> git.ipfire.org Git - thirdparty/git.git/commitdiff
compat/winansi: check for errors of CreateThread() correctly
authorSeija Kijin <doremylover123@gmail.com>
Wed, 1 Feb 2023 22:20:33 +0000 (22:20 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Feb 2023 22:36:19 +0000 (14:36 -0800)
The return value for failed thread creation is NULL,
not INVALID_HANDLE_VALUE, unlike other Windows API functions.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/winansi.c

index 3abe8dd5a2711b5268cb5efe623d8c027f0d3d83..f83610f684d031f8660542b108a940207cad89df 100644 (file)
@@ -644,7 +644,7 @@ void winansi_init(void)
 
        /* start console spool thread on the pipe's read end */
        hthread = CreateThread(NULL, 0, console_thread, NULL, 0, NULL);
-       if (hthread == INVALID_HANDLE_VALUE)
+       if (!hthread)
                die_lasterr("CreateThread(console_thread) failed");
 
        /* schedule cleanup routine */