summaryrefslogtreecommitdiff
path: root/builtin-add.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-11-25 18:07:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-25 18:23:10 (GMT)
commit324ccbd6a09816af830b22b02bbeb06349141849 (patch)
tree4a3524f7dc0143c35a5183827d34a517e38214a8 /builtin-add.c
parentf64fe7b48104c0da3fa2b9f3d927a7a7fbb0d8ea (diff)
downloadgit-324ccbd6a09816af830b22b02bbeb06349141849.zip
git-324ccbd6a09816af830b22b02bbeb06349141849.tar.gz
git-324ccbd6a09816af830b22b02bbeb06349141849.tar.bz2
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>
Diffstat (limited to 'builtin-add.c')
-rw-r--r--builtin-add.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin-add.c b/builtin-add.c
index dd895df..7c6a296 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -138,9 +138,10 @@ static void refresh(int verbose, const char **pathspec)
int interactive_add(int argc, const char **argv)
{
int status;
- const char **args = xmalloc(sizeof(const char *) * (argc + 1));
+ const char **args = xcalloc(sizeof(const char *), (argc + 2));
+
args[0] = "add--interactive";
- memcpy((void *)args + sizeof(const char *), argv, sizeof(const char *) * argc);
+ memcpy(&(args[1]), argv, sizeof(const char *) * argc);
args[argc + 1] = NULL;
status = run_command_v_opt(args, RUN_GIT_CMD);