summaryrefslogtreecommitdiff
path: root/exec_cmd.c
diff options
context:
space:
mode:
authorSteffen Prohaska <prohaska@zib.de>2009-01-18 12:00:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-26 08:26:05 (GMT)
commit2cd72b0b290e40fb4d6a925ce26603503f01aa09 (patch)
tree6ef034279ded05faad660074fe3e5b5fff4dc70e /exec_cmd.c
parent4dd47c3b867f51211d0dc4474dab0fee5ca614da (diff)
downloadgit-2cd72b0b290e40fb4d6a925ce26603503f01aa09.zip
git-2cd72b0b290e40fb4d6a925ce26603503f01aa09.tar.gz
git-2cd72b0b290e40fb4d6a925ce26603503f01aa09.tar.bz2
git_extract_argv0_path(): Move check for valid argv0 from caller to callee
This simplifies the calling code. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'exec_cmd.c')
-rw-r--r--exec_cmd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/exec_cmd.c b/exec_cmd.c
index e508f1e..f8f416b 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -22,7 +22,11 @@ const char *system_path(const char *path)
const char *git_extract_argv0_path(const char *argv0)
{
- const char *slash = argv0 + strlen(argv0);
+ const char *slash;
+
+ if (!argv0 || !*argv0)
+ return NULL;
+ slash = argv0 + strlen(argv0);
while (argv0 <= slash && !is_dir_sep(*slash))
slash--;