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

[PATCH 1/4] Use PATH_MAX constant for --bare.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Dec 31, 2006, 04:28 UTC
Message-ID
<20061231042853.GA5823@spearce.org>

For easier portability we prefer PATH_MAX over seemingly random constants like 1024. Make it so.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 git.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git.c b/git.c
index 50ebd86..ec897dc 100644
--- a/git.c
+++ b/git.c
@@ -69,8 +69,8 @@ static int handle_options(const char*** argv, int* argc)
 		} else if (!strncmp(cmd, "--git-dir=", 10)) {
 			setenv("GIT_DIR", cmd + 10, 1);
 		} else if (!strcmp(cmd, "--bare")) {
-			static char git_dir[1024];
-			setenv("GIT_DIR", getcwd(git_dir, 1024), 1);
+			static char git_dir[PATH_MAX+1];
+			setenv("GIT_DIR", getcwd(git_dir, sizeof(git_dir)), 1);
 		} else {
 			fprintf(stderr, "Unknown option: %s\n", cmd);
 			usage(git_usage_string);
-- 
1.5.0.rc0.g6bb1
Message 1 of 1 in “Use PATH_MAX constant for --bare.”
  1. 1/4 Use PATH_MAX constant for --bare.Shawn O. Pearce, Dec 31, 2006

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.