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

Re: [PATCH v7 1/3] compat: add a mkstemps() compatibility function

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 1, 2009, 02:03 UTC
Message-ID
<7vr5y4ogl0.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1243758952-28972-1-git-send-email-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 14 quoted lines
> mkstemps() is a BSD extension so provide an implementation
> for cross-platform use.
> ...
> diff --git a/git-compat-util.h b/git-compat-util.h
> index c7cf2d5..5a2d4e7 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -113,6 +113,10 @@
>  #define PATH_MAX 4096
>  #endif
>  
> +#ifndef TMP_MAX
> +#define TMP_MAX 16384
> +#endif

Giving fallback definition to PATH_MAX and PRIuMAX (as seen in the context of the hunk) makes perfect sense. TMP_MAX on the other hand is being obsoleted in POSIX.1, and more importantly, we do not use it in our program anywhere other than the compatibility implementation of mkstemps().

I'll move this to the file that is used, which is compat/mkstemps.c. I'll further change the constant not to inherit from whatever the platform happens to define TMP_MAX to be. POSIX.1 says "at least 25", but the fallback implementation does not need to be constrained to such a low number.

Thanks.
Previous: Johannes Sixt
Message 5 of 5 in “compat: add a mkstemps() compatibility function”
  1. 1/3 compat: add a mkstemps() compatibility functionDavid Aguilar, May 31, 2009
  2. 2/3 compat: add a basename() compatibility functionDavid Aguilar, May 31, 2009
  3. 3/3 diff: generate pretty filenames in prep_temp_blob()David Aguilar, May 31, 2009
  4. Johannes SixtJun 2, 2009
  5. Junio C HamanoJun 1, 2009

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.