summaryrefslogtreecommitdiffstats
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-09-04 19:34:19 +0200
committerJunio C Hamano <gitster@pobox.com>2015-09-04 19:34:19 +0200
commitef0e938a1a4b34bc0882e1c542c8e99c98737f7d (patch)
tree95fd055bd45588d16eea7a93158ce92d6489c066 /sha1_file.c
parentGit 2.4.8 (diff)
parentGit 2.3.9 (diff)
downloadgit-ef0e938a1a4b34bc0882e1c542c8e99c98737f7d.tar.xz
git-ef0e938a1a4b34bc0882e1c542c8e99c98737f7d.zip
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)) {