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

Re: [PATCH] Use PATH_MAX rather than a hardwired constant maximum length.

From
Alex Riesen <raa.lkml@gmail.com>
Date
Apr 26, 2007, 12:14 UTC
Message-ID
<81b0412b0704260514k1eeec53ex97df3be600244305@mail.gmail.com>
In-Reply-To
<20070426091254.GA23586@midwinter.com>
On 4/26/07, koreth@midwinter.com <koreth@midwinter.com> wrote:
> Signed-off-by: Steven Grimm <koreth@midwinter.com>
> ---
>
> Is the +1 really needed? The existing code is doing this in other places

No, not according SUSv3, where PATH_MAX is defined as "Maximum number of bytes in a pathname, including the terminating null character." http://www.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html#tag_13_24

getcwd expects the size of the buffer, so it can store the cwd _and_ NUL. See ERANGE in in SUSv3: http://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html

> but I'm not sure it's necessary since we're also doing sizeof(buffer)-1
The -1 is wrong too.
> in the getcwd() call. I figured it was best to be consistent with the
> existing code, e.g. setup_git_directory_gently().

setup_git_directory_gently is wrong. But it does not really matter in practice.

Previous: koreth@midwinter.comNext: Alex Riesen
Message 5 of 6 in “Change git-rev-parse --show-cdup to output an absolute path”
  1. Change git-rev-parse --show-cdup to output an absolute pathkoreth@midwinter.com, Apr 25, 2007
  2. Alex RiesenApr 26, 2007
  3. Steven GrimmApr 26, 2007
  4. Use PATH_MAX rather than a hardwired constant maximum length.koreth@midwinter.com, Apr 26, 2007
  5. Alex RiesenApr 26, 2007
  6. Alex RiesenApr 26, 2007

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.