summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-09-09 14:30:35 -0700
committerJunio C Hamano <gitster@pobox.com>2015-09-09 14:30:35 -0700
commitf0bc85462332644ecd2386e0f4fdc9948b9f47dc (patch)
tree6ee0f442ec888c33a25e825a4e451b921c0701ff /sha1_file.c
parent7a2c4af7a82eebf2ed0e60a2b36c31e70c619264 (diff)
parent27ea6f85beff1173ec74349fa35c45951feee570 (diff)
downloadgit-f0bc85462332644ecd2386e0f4fdc9948b9f47dc.tar.gz
Sync with 2.5.2
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 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)) {