From: Johannes Sixt <j6t@kdbg.org>
To: Rose via GitGitGadget <gitgitgadget@gmail.com>
Cc: Seija Kijin <doremylover123@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH v4] compat/winansi: check for errors of CreateThread() correctly
Date: Wed, 1 Feb 2023 23:39:57 +0100 [thread overview]
Message-ID: <e6fa3452-6d82-bf40-ddb2-44dc686a2e29@kdbg.org> (raw)
In-Reply-To: <pull.1445.v4.git.git.1675290034144.gitgitgadget@gmail.com>
Am 01.02.23 um 23:20 schrieb Rose via GitGitGadget:
> From: Seija Kijin <doremylover123@gmail.com>
>
> 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>
> ---
> win32: check for NULL after creating thread
>
> 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
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1445%2FAtariDreams%2FhThread-v4
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1445/AtariDreams/hThread-v4
> Pull-Request: https://github.com/git/git/pull/1445
>
> Range-diff vs v3:
>
> 1: 1cbc43e0d82 ! 1: 6c4188977e8 win32: check for NULL after creating thread
> @@ Metadata
> Author: Seija Kijin <doremylover123@gmail.com>
>
> ## Commit message ##
> - win32: check for NULL after creating thread
> -
> - Check for NULL handles, not "INVALID_HANDLE,"
> - as CreateThread guarantees a valid handle in most cases.
> + compat/winansi: check for errors of CreateThread() correctly
>
> The return value for failed thread creation is NULL,
> not INVALID_HANDLE_VALUE, unlike other Windows API functions.
>
>
> compat/winansi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/compat/winansi.c b/compat/winansi.c
> index 3abe8dd5a27..f83610f684d 100644
> --- a/compat/winansi.c
> +++ b/compat/winansi.c
> @@ -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 */
>
> base-commit: 2fc9e9ca3c7505bc60069f11e7ef09b1aeeee473
This iteration looks good, thank you!
Acked-by: Johannes Sixt <j6t@kdbg.org>
-- Hannes
prev parent reply other threads:[~2023-02-01 22:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 14:49 [PATCH] win32: check for NULL when creating thread Rose via GitGitGadget
2023-01-31 14:53 ` [PATCH v2] win32: check for NULL after " Rose via GitGitGadget
2023-02-01 14:40 ` [PATCH v3] " Rose via GitGitGadget
2023-02-01 21:51 ` Johannes Sixt
2023-02-01 22:20 ` [PATCH v4] compat/winansi: check for errors of CreateThread() correctly Rose via GitGitGadget
2023-02-01 22:37 ` Junio C Hamano
2023-02-01 22:39 ` Johannes Sixt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e6fa3452-6d82-bf40-ddb2-44dc686a2e29@kdbg.org \
--to=j6t@kdbg.org \
--cc=doremylover123@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).