Code

Use PATH_MAX constant for --bare.
authorShawn O. Pearce <spearce@spearce.org>
Sun, 31 Dec 2006 04:28:53 +0000 (23:28 -0500)
committerJunio C Hamano <junkio@cox.net>
Sun, 31 Dec 2006 06:22:13 +0000 (22:22 -0800)
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git.c

diff --git a/git.c b/git.c
index 50ebd869ad47cb2803a5a1e581442d7e72842034..ec897dc88c4b258a959db825f7ee2f6ec9f129de 100644 (file)
--- 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);