aboutsummaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-02 11:26:40 -0800
committerJunio C Hamano <gitster@pobox.com>2010-12-02 11:26:40 -0800
commita49e9af4939c1223020db7915ee612d836c1bcdc (patch)
tree51285aad2c6a4942b85542df0a07d658d69ef6df /setup.c
parent9f6774ed86a9ac22142c0b37e26e67eb1d032962 (diff)
parent55846b9abd128185388418e025651cfd6a299a0e (diff)
downloadgit-a49e9af4939c1223020db7915ee612d836c1bcdc.tar.gz
git-a49e9af4939c1223020db7915ee612d836c1bcdc.tar.xz
Merge branch 'tr/maint-merge-file-subdir' into maint
* tr/maint-merge-file-subdir: merge-file: correctly find files when called in subdir prefix_filename(): safely handle the case where pfx_len=0
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/setup.c b/setup.c
index a3b76de2b..346ef2eb2 100644
--- a/setup.c
+++ b/setup.c
@@ -46,7 +46,7 @@ const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
{
static char path[PATH_MAX];
#ifndef WIN32
- if (!pfx || !*pfx || is_absolute_path(arg))
+ if (!pfx_len || is_absolute_path(arg))
return arg;
memcpy(path, pfx, pfx_len);
strcpy(path + pfx_len, arg);
@@ -55,7 +55,7 @@ const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
/* don't add prefix to absolute paths, but still replace '\' by '/' */
if (is_absolute_path(arg))
pfx_len = 0;
- else
+ else if (pfx_len)
memcpy(path, pfx, pfx_len);
strcpy(path + pfx_len, arg);
for (p = path + pfx_len; *p; p++)