diff options
| author | Junio C Hamano <gitster@pobox.com> | 2010-11-17 15:00:56 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2010-11-17 15:00:56 -0800 |
| commit | ba0254cb32537b7a7e92854a51256475ee83cdda (patch) | |
| tree | 6e8bcfa99201c20d8647600e74b78e580cfd23cf /setup.c | |
| parent | Merge branch 'jn/send-pack-error' (diff) | |
| parent | merge-file: correctly find files when called in subdir (diff) | |
| download | git-ba0254cb32537b7a7e92854a51256475ee83cdda.tar.gz git-ba0254cb32537b7a7e92854a51256475ee83cdda.zip | |
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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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++) |
