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

Re: free and errno, was Re: [PATCH] apply: replace mksnpath() with a mkpathdup() call

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 4, 2024, 23:08 UTC
Message-ID
<xmqqv84wybdo.fsf@gitster.g>
In-Reply-To
<20240404225313.GA2512966@coredump.intra.peff.net>
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 ;-)
Previous: Jeff KingNext: René Scharfe
Message 4 of 15 in “apply: replace mksnpath() with a mkpathdup() call”
  1. apply: replace mksnpath() with a mkpathdup() callRené Scharfe, Apr 4, 2024
  2. Junio C HamanoApr 4, 2024
  3. free and errno, was Re: [PATCH] apply: replace mksnpath() with a mkpathdup() callJeff King, Apr 4, 2024
  4. Junio C HamanoApr 4, 2024
  5. René ScharfeApr 5, 2024
  6. Jeff KingApr 5, 2024
  7. Jeff KingApr 5, 2024
  8. René ScharfeApr 6, 2024
  9. Jeff KingApr 7, 2024
  10. René ScharfeApr 14, 2024
  11. Jeff KingApr 24, 2024
  12. 1/2 apply: avoid fixed-size buffer in create_one_file()René Scharfe, Apr 5, 2024
  13. 2/2 path: remove mksnpath()René Scharfe, Apr 5, 2024
  14. Jeff KingApr 5, 2024
  15. Junio C HamanoApr 5, 2024

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.