summaryrefslogtreecommitdiff
path: root/fsmonitor.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-05-30 21:51:27 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-05-30 21:51:28 +0900
commit7c3d15fe3113cf48db60656eedd152c46f47bf6b (patch)
treeafcbf8eb2ae30d903c3649aab8093a8c3a8f4b82 /fsmonitor.c
parentMerge branch 'jk/config-blob-sans-repo' (diff)
parentfmt_with_err: add a comment that truncation is OK (diff)
downloadtgif-7c3d15fe3113cf48db60656eedd152c46f47bf6b.tar.xz
Merge branch 'jk/snprintf-truncation'
Avoid unchecked snprintf() to make future code auditing easier. * jk/snprintf-truncation: fmt_with_err: add a comment that truncation is OK shorten_unambiguous_ref: use xsnprintf fsmonitor: use internal argv_array of struct child_process log_write_email_headers: use strbufs http: use strbufs instead of fixed buffers
Diffstat (limited to 'fsmonitor.c')
-rw-r--r--fsmonitor.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fsmonitor.c b/fsmonitor.c
index ed3d1a074d..665bd2d425 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -97,19 +97,13 @@ void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
static int query_fsmonitor(int version, uint64_t last_update, struct strbuf *query_result)
{
struct child_process cp = CHILD_PROCESS_INIT;
- char ver[64];
- char date[64];
- const char *argv[4];
- if (!(argv[0] = core_fsmonitor))
+ if (!core_fsmonitor)
return -1;
- snprintf(ver, sizeof(ver), "%d", version);
- snprintf(date, sizeof(date), "%" PRIuMAX, (uintmax_t)last_update);
- argv[1] = ver;
- argv[2] = date;
- argv[3] = NULL;
- cp.argv = argv;
+ argv_array_push(&cp.args, core_fsmonitor);
+ argv_array_pushf(&cp.args, "%d", version);
+ argv_array_pushf(&cp.args, "%" PRIuMAX, (uintmax_t)last_update);
cp.use_shell = 1;
cp.dir = get_git_work_tree();