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().