diff options
author | Steffen Prohaska <prohaska@zib.de> | 2009-01-18 13:00:11 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-26 00:26:05 -0800 |
commit | 2cd72b0b290e40fb4d6a925ce26603503f01aa09 (patch) | |
tree | 6ef034279ded05faad660074fe3e5b5fff4dc70e /exec_cmd.c | |
parent | 4dd47c3b867f51211d0dc4474dab0fee5ca614da (diff) | |
download | git-2cd72b0b290e40fb4d6a925ce26603503f01aa09.tar.gz |
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.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/exec_cmd.c b/exec_cmd.c index e508f1e66d..f8f416b646 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--; |