Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-09-04 20:43:23 +0300
committerJunio C Hamano <gitster@pobox.com>2015-09-04 20:43:23 +0300
commit3d3caf0b78106c390fc5daceb95ee968312765dd (patch)
treed41a558b9e3cc7ad256636f103fdf243a8bf7c19 /sha1_file.c
parentfb8880dea3111deb4b1134471aa36f99285d86dc (diff)
parent74b67638166ca2e66497ede559dbf393e7af8b40 (diff)
Sync with 2.4.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 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)) {