summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-09-04 10:29:28 -0700
committerJunio C Hamano <gitster@pobox.com>2015-09-04 10:29:28 -0700
commit8267cd11d677f1a5f8441ac2880f5e9d48dba60b (patch)
tree377d0d4141d50fbf44f68896a7e4f2e18ecd18ff /sha1_file.c
parent9a3d637541a5b6fcd84b6f5fa057e597d1696460 (diff)
parent441c4a40173fe1ee8a5c0094e587dfc47e2a6460 (diff)
downloadgit-8267cd11d677f1a5f8441ac2880f5e9d48dba60b.tar.gz
Sync with 2.2.3
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 88f06bac92..ec3adcaead 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)) {