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

Re: [PATCH] mingw: do not set errno to 0 on success

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Nov 24, 2010, 09:54 UTC
Message-ID
<AANLkTi=8OnTJHgX3-g9uqLX2B3+eUQf0uykynrwW3L4E@mail.gmail.com>
In-Reply-To
<7v4ob7vb1m.fsf@alter.siamese.dyndns.org>
On Wed, Nov 24, 2010 at 1:07 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Erik Faye-Lund <kusmabite@gmail.com> writes:
>
>> Currently do_lstat always sets errno to 0 on success. This incorrectly
>> overwrites previous errors.
>>
>> Fetch the error-code into a temporary variable instead, and assign that
>> to errno on failure.
>>
>> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
>> ---
>>
>> A bug I found while hunting down another regression. maint-worthy, perhaps?
>
> I would say so, as long as the error return from get_file_attr() is
> trustworthy.

It looks trustworthy to me; it returns 0 if GetFileAttributesExA succeeds, and either EACCES, ENAMETOOLONG, ENOMEM or ENOENT based on the result of GetLastError().

Previous: Junio C Hamano
Message 3 of 3 in “mingw: do not set errno to 0 on success”
  1. mingw: do not set errno to 0 on successErik Faye-Lund, Nov 23, 2010
  2. Junio C HamanoNov 24, 2010
  3. Erik Faye-LundNov 24, 2010

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.