summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-09-04 10:34:19 -0700
committerJunio C Hamano <gitster@pobox.com>2015-09-04 10:34:19 -0700
commitef0e938a1a4b34bc0882e1c542c8e99c98737f7d (patch)
tree95fd055bd45588d16eea7a93158ce92d6489c066 /sha1_file.c
parent8545932d45c91437ac439b1a2df12cf397f71311 (diff)
parentecad27cf98c391d5cfdc26ce0e442e02347baad0 (diff)
downloadgit-ef0e938a1a4b34bc0882e1c542c8e99c98737f7d.tar.gz
Sync with 2.3.9
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 a68ae18dd8..99155c0d6b 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)) {