summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-04-16 23:29:26 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-04-16 23:29:26 -0700
commitcb054eb26452e07a3cb34703e1579b97f5c7e6ab (patch)
treebdb83f6ceb82421f173934431c1299dc167dbd06 /fast-import.c
parentEleventh batch for 2.13 (diff)
parentdaemon: use an argv_array to exec children (diff)
downloadtgif-cb054eb26452e07a3cb34703e1579b97f5c7e6ab.tar.xz
Merge branch 'jk/snprintf-cleanups'
Code clean-up. * jk/snprintf-cleanups: daemon: use an argv_array to exec children gc: replace local buffer with git_path transport-helper: replace checked snprintf with xsnprintf convert unchecked snprintf into xsnprintf combine-diff: replace malloc/snprintf with xstrfmt replace unchecked snprintf calls with heap buffers receive-pack: print --pack-header directly into argv array name-rev: replace static buffer with strbuf create_branch: use xstrfmt for reflog message create_branch: move msg setup closer to point of use avoid using mksnpath for refs avoid using fixed PATH_MAX buffers for refs fetch: use heap buffer to format reflog tag: use strbuf to format tag header diff: avoid fixed-size buffer for patch-ids odb_mkstemp: use git_path_buf odb_mkstemp: write filename into strbuf do not check odb_mkstemp return value for errors
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fast-import.c b/fast-import.c
index f6f416f20a..1ea3a08609 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -890,14 +890,15 @@ static struct tree_content *dup_tree_content(struct tree_content *s)
static void start_packfile(void)
{
- static char tmp_file[PATH_MAX];
+ struct strbuf tmp_file = STRBUF_INIT;
struct packed_git *p;
struct pack_header hdr;
int pack_fd;
- pack_fd = odb_mkstemp(tmp_file, sizeof(tmp_file),
- "pack/tmp_pack_XXXXXX");
- FLEX_ALLOC_STR(p, pack_name, tmp_file);
+ pack_fd = odb_mkstemp(&tmp_file, "pack/tmp_pack_XXXXXX");
+ FLEX_ALLOC_STR(p, pack_name, tmp_file.buf);
+ strbuf_release(&tmp_file);
+
p->pack_fd = pack_fd;
p->do_not_close = 1;
pack_file = sha1fd(pack_fd, p->pack_name);