From 9c906c8e6c49b0bfa66580a35bcf013ee122970c Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Thu, 22 Nov 2007 22:24:56 +0100 Subject: [PATCH] Be more careful in splitting the program name from the path. A git program can be invoked using with such a full path name: C:\Src\mingw-git\t\trash/..\..\git-fetch-pack.exe i.e. it can contain both types of path separators. We must pick the one that comes last. Signed-off-by: Johannes Sixt --- git.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/git.c b/git.c index e5fdd04057..04ef05fcf5 100644 --- a/git.c +++ b/git.c @@ -399,8 +399,9 @@ int main(int argc, const char **argv) * if we don't have anything better. */ #ifdef __MINGW32__ - if (!slash) - slash = strrchr(cmd, '\\'); + char *bslash = strrchr(cmd, '\\'); + if (!slash || (bslash && bslash > slash)) + slash = bslash; #endif if (slash) { *slash++ = 0;