]> Pileus Git - ~andy/git/commitdiff
shell: add missing initialization of argv0_path
authorDima Sharov <git.avalakvista@gmail.com>
Thu, 5 May 2011 06:40:17 +0000 (09:40 +0300)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 May 2011 16:32:28 +0000 (09:32 -0700)
According to c6dfb39 (remote-curl: add missing initialization of
argv0_path, 2009-10-13), stand-alone programs (non-builtins)
must call git_extract_argv0_path(argv[0]) in order to help builds
that derive the installation prefix at runtime. Without this call,
the program segfaults (or raises an assertion failure).

Signed-off-by: Dima Sharov <git.avalakvista@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
shell.c

diff --git a/shell.c b/shell.c
index dea4cfdd2c230af6afd6233cacfa5c776a9962f9..abb862246ef01743424e4a447ee169f3fdbb9f51 100644 (file)
--- a/shell.c
+++ b/shell.c
@@ -137,6 +137,8 @@ int main(int argc, char **argv)
        int devnull_fd;
        int count;
 
+       git_extract_argv0_path(argv[0]);
+
        /*
         * Always open file descriptors 0/1/2 to avoid clobbering files
         * in die().  It also avoids not messing up when the pipes are