git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] shell: add missing initialization of argv0_path

From
DSDima Sharov <git.avalakvista@gmail.com>
Date
May 1, 2011, 06:06 UTC
Message-ID
<8F1D5462-15DC-4F01-9F6A-5C0E477B12F6@gmail.com>

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>
---
 shell.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/shell.c b/shell.c
index dea4cfd..abb8622 100644
--- 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
-- 
1.7.2.3
Message 1 of 1 in “shell: add missing initialization of argv0_path”
  1. shell: add missing initialization of argv0_pathDima Sharov, May 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.