diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-09-09 14:30:35 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-09-09 14:30:35 -0700 |
commit | f0bc85462332644ecd2386e0f4fdc9948b9f47dc (patch) | |
tree | 6ee0f442ec888c33a25e825a4e451b921c0701ff /sha1_file.c | |
parent | 7a2c4af7a82eebf2ed0e60a2b36c31e70c619264 (diff) | |
parent | 27ea6f85beff1173ec74349fa35c45951feee570 (diff) | |
download | git-f0bc85462332644ecd2386e0f4fdc9948b9f47dc.tar.gz |
Sync with 2.5.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 08302f5857..d295a3225a 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)) { |