summaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-11-17 15:00:56 -0800
committerJunio C Hamano <gitster@pobox.com>2010-11-17 15:00:56 -0800
commitba0254cb32537b7a7e92854a51256475ee83cdda (patch)
tree6e8bcfa99201c20d8647600e74b78e580cfd23cf /setup.c
parente2110c8d881eb61db581b6b9ddd9568f20cf24c7 (diff)
parent55846b9abd128185388418e025651cfd6a299a0e (diff)
downloadgit-ba0254cb32537b7a7e92854a51256475ee83cdda.tar.gz
Merge branch 'tr/maint-merge-file-subdir'
* 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 a3b76de2bb..346ef2eb2d 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++)