This simplifies the calling code. Signed-off-by: Steffen Prohaska <prohaska@xxxxxx> --- exec_cmd.c | 3 +++ git.c | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/exec_cmd.c b/exec_cmd.c index 23a52cf..89931e4 100644 --- a/exec_cmd.c +++ b/exec_cmd.c @@ -23,6 +23,9 @@ const char *system_path(const char *path) const char *git_extract_argv0_path(const char *argv0) { + if (!argv0 || !*argv0) + return 0; + const char *slash = argv0 + strlen(argv0); while (argv0 <= slash && !is_dir_sep(*slash)) diff --git a/git.c b/git.c index b99b1b2..9c8da93 100644 --- a/git.c +++ b/git.c @@ -422,9 +422,8 @@ int main(int argc, const char **argv) const char *cmd; int done_alias = 0; - if (argv[0] && *argv[0]) - cmd = git_extract_argv0_path(argv[0]); - else + cmd = git_extract_argv0_path(argv[0]); + if (!cmd) cmd = "git-help"; /* -- 1.6.1.87.g15624 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html