diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-12-02 11:26:40 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-12-02 11:26:40 -0800 |
commit | a49e9af4939c1223020db7915ee612d836c1bcdc (patch) | |
tree | 51285aad2c6a4942b85542df0a07d658d69ef6df /setup.c | |
parent | 9f6774ed86a9ac22142c0b37e26e67eb1d032962 (diff) | |
parent | 55846b9abd128185388418e025651cfd6a299a0e (diff) | |
download | git-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.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++) |