Skip to content

Commit

Permalink
shell: add missing initialization of argv0_path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dima Sharov authored and gitster committed May 5, 2011
1 parent 2f312e8 commit 2d9932c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shell.c
Expand Up @@ -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
Expand Down

0 comments on commit 2d9932c

Please sign in to comment.