]> git.ipfire.org Git - thirdparty/git.git/blobdiff - setup.c
Makefile: Remove git-fsck and git-verify-pack from PROGRAMS
[thirdparty/git.git] / setup.c
diff --git a/setup.c b/setup.c
index e9d3f5aab63225df7f1b495a19740408d23973a8..a45ea8309a9773160597f142f1208a6129885499 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -216,7 +216,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
                die("Not a git repository: '%s'", gitdirenv);
        }
 
-       if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
+       if (!getcwd(cwd, sizeof(cwd)-1) || cwd[0] != '/')
                die("Unable to read current working directory");
 
        offset = len = strlen(cwd);
@@ -251,7 +251,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
        offset++;
        cwd[len++] = '/';
        cwd[len] = 0;
-       inside_git_dir = !strncmp(cwd + offset, ".git/", 5);
+       inside_git_dir = !prefixcmp(cwd + offset, ".git/");
        return cwd + offset;
 }