git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Explicitly set errno to ENOENT if err is not ERROR_DIRECTORY

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 19, 2022, 18:33 UTC
Message-ID
<221219.86mt7jxmwd.gmgdl@evledraar.gmail.com>
In-Reply-To
<pull.1402.git.git.1671465108414.gitgitgadget@gmail.com>
On Mon, Dec 19 2022, Rose via GitGitGadget wrote:
Show 36 quoted lines
> From: Seija Kijin <doremylover123@gmail.com>
>
> At this point, the only two possible errors are
> ERROR_DIRECTORY or ERROR_BAD_PATHNAME.
>
> This code clarifies this and also saves a call to
> err_win_to_posix.
>
> Signed-off-by: Seija Kijin <doremylover123@gmail.com>
> ---
>     Explicitly set errno to ENOENT if err is not ERROR_DIRECTORY
>     
>     At this point, the only two possible errors are ERROR_DIRECTORY or
>     ERROR_BAD_PATHNAME.
>     
>     This code clarifies this and also saves a call to err_win_to_posix.
>     
>     Signed-off-by: Seija Kijin doremylover123@gmail.com
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1402%2FAtariDreams%2Fopendir-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1402/AtariDreams/opendir-v1
> Pull-Request: https://github.com/git/git/pull/1402
>
>  compat/win32/dirent.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/compat/win32/dirent.c b/compat/win32/dirent.c
> index 52420ec7d4d..8f94a5ab6db 100644
> --- a/compat/win32/dirent.c
> +++ b/compat/win32/dirent.c
> @@ -34,13 +34,13 @@ DIR *opendir(const char *name)
>  	if (len && !is_dir_sep(pattern[len - 1]))
>  		pattern[len++] = '/';
>  	pattern[len++] = '*';
> -	pattern[len] = 0;
> +	pattern[len] = '\0';

Maybe the subject of this patch is a good change (I have no idea, and don't use Windows), but this just seems like unrelated general cleanup.

I think it's probably good to change these sorts cases from 0 to '\0', but let's do that as a seperate change...

Previous: Johannes Sixt
Message 4 of 4 in “Explicitly set errno to ENOENT if err is not ERROR_DIRECTORY”
  1. Explicitly set errno to ENOENT if err is not ERROR_DIRECTORYRose via GitGitGadget, Dec 19, 2022
  2. win32: explicitly set errno to enoent if err is not error_directoryRose via GitGitGadget, Dec 19, 2022
  3. Johannes SixtDec 20, 2022
  4. Ævar Arnfjörð BjarmasonDec 19, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.