Re: free and errno, was Re: [PATCH] apply: replace mksnpath() with a mkpathdup() call
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
>> + free(newpath);
>> if (errno != EEXIST)
>> break;
>> ++nr;
>
> At any rate, you can probably see the places where free() clobbering
> errno would be a problem here. Our return when "res < 0" (though I don't
> think any of the callers actually care about errno after that), the
> check for EEXIST at the bottom of the loop, and after we break out of
> the loop, we use error_errno() to report it.
Yeah, a failing free() is unlikely to set errno to EEXIST ;-)