@matheusbsbs / matheus-bagliano / commits / 324ccbd6a0
Fork 0

builtin-add: fix command line building to call interactive

The earlier 7c0ab4458994aa895855abc4a504cf693ecc0cf1 (Teach builtin-add to pass multiple paths to git-add--interactive) did not allocate enough, and had unneeded (void*) pointer arithmetic. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 25, 2007 at 10:07 UTC 324ccbd6a09816af830b22b02bbeb06349141849
1 file changed +3 -2
builtin-add.c
+3 -2
@@ -138,9 +138,10 @@ static void refresh(int verbose, const char **pathspec)
138 int interactive_add(int argc, const char **argv)
139 {
140 int status;
141 - const char **args = xmalloc(sizeof(const char *) * (argc + 1));
141 + const char **args = xcalloc(sizeof(const char *), (argc + 2));
142 +
143 args[0] = "add--interactive";
143 - memcpy((void *)args + sizeof(const char *), argv, sizeof(const char *) * argc);
144 + memcpy(&(args[1]), argv, sizeof(const char *) * argc);
145 args[argc + 1] = NULL;
146
147 status = run_command_v_opt(args, RUN_GIT_CMD);