diff options
| author | Junio C Hamano <gitster@pobox.com> | 2015-09-04 10:25:23 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2015-09-04 10:25:23 -0700 |
| commit | f54cb059b18e704d8b51d0cd4736344422650d6f (patch) | |
| tree | 324187d0682f989593a532d231acf8472d4d2f2b /sha1_file.c | |
| parent | Git 2.2.2 (diff) | |
| parent | show-branch: use a strbuf for reflog descriptions (diff) | |
| download | git-f54cb059b18e704d8b51d0cd4736344422650d6f.tar.gz git-f54cb059b18e704d8b51d0cd4736344422650d6f.zip | |
Merge branch 'jk/long-paths' into maint-2.2
Diffstat (limited to 'sha1_file.c')
| -rw-r--r-- | sha1_file.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sha1_file.c b/sha1_file.c index d7f1838c13..b231b62784 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -377,15 +377,12 @@ void read_info_alternates(const char * relative_base, int depth) char *map; size_t mapsz; struct stat st; - const char alt_file_name[] = "info/alternates"; - /* Given that relative_base is no longer than PATH_MAX, - ensure that "path" has enough space to append "/", the - file name, "info/alternates", and a trailing NUL. */ - char path[PATH_MAX + 1 + sizeof alt_file_name]; + char *path; int fd; - sprintf(path, "%s/%s", relative_base, alt_file_name); + path = xstrfmt("%s/info/alternates", relative_base); fd = git_open_noatime(path); + free(path); if (fd < 0) return; if (fstat(fd, &st) || (st.st_size == 0)) { |
