diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-09-04 10:43:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-09-04 10:43:23 -0700 |
commit | 3d3caf0b78106c390fc5daceb95ee968312765dd (patch) | |
tree | d41a558b9e3cc7ad256636f103fdf243a8bf7c19 /sha1_file.c | |
parent | fb8880dea3111deb4b1134471aa36f99285d86dc (diff) | |
parent | 74b67638166ca2e66497ede559dbf393e7af8b40 (diff) | |
download | git-3d3caf0b78106c390fc5daceb95ee968312765dd.tar.gz |
Sync with 2.4.9
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 f2e993e0b8..17262e1826 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)) { |