Skip to content

Commit

Permalink
win32: check for NULL after creating thread
Browse files Browse the repository at this point in the history
Check for NULL handles, not "INVALID_HANDLE,"
as CreateThread guarantees a valid handle in most cases.

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>
  • Loading branch information
GameCubeGBA authored and AtariDreams committed Jan 31, 2023
1 parent 2fc9e9c commit c956caf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compat/winansi.c
Expand Up @@ -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 */
Expand Down

0 comments on commit c956caf

Please sign in to comment.