From: Chris Torek Date: Thu, 04 Dec 2025 11:51:57 GMT Subject: Re: [PATCH 1/4] wrapper: add git_mkdtemp() Message-ID: In-Reply-To: <65c997a7-e480-4617-a761-fc9dc8a7b20d@web.de> fairly trivial, but: On Wed, Dec 3, 2025 at 2:52 AM René Scharfe wrote: > Extend git_mkstemps_mode() to optionally call mkdir(2) instead of > open(2), then use that ability to create a mkdtemp(3) replacement, > git_mkdtemp(). We'll start using it in the next commit. [snip] > - fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode); > + if (dir) > + fd = mkdir(pattern, mode); > + else > + fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode); mkdir() returns a success (0) / fail (-1) indication, rather than a file descriptor, so this is kind of misleading. I think a comment mentioning it would suffice (but also be a good idea, lest someone later think it needs a close() call). Chris