From: Erik Faye-Lund Date: Wed, 24 Nov 2010 09:54:03 GMT Subject: Re: [PATCH] mingw: do not set errno to 0 on success Message-ID: In-Reply-To: <7v4ob7vb1m.fsf@alter.siamese.dyndns.org> On Wed, Nov 24, 2010 at 1:07 AM, Junio C Hamano wrote: > Erik Faye-Lund 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 >> --- >> >> 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().