prefix_path: use is_absolute_path() instead of *orig == '/'
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
aa9c83c219
commit
9a13ba1bed
4
setup.c
4
setup.c
@ -91,7 +91,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
|
|||||||
{
|
{
|
||||||
const char *orig = path;
|
const char *orig = path;
|
||||||
char *sanitized = xmalloc(len + strlen(path) + 1);
|
char *sanitized = xmalloc(len + strlen(path) + 1);
|
||||||
if (*orig == '/')
|
if (is_absolute_path(orig))
|
||||||
strcpy(sanitized, path);
|
strcpy(sanitized, path);
|
||||||
else {
|
else {
|
||||||
if (len)
|
if (len)
|
||||||
@ -100,7 +100,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
|
|||||||
}
|
}
|
||||||
if (sanitary_path_copy(sanitized, sanitized))
|
if (sanitary_path_copy(sanitized, sanitized))
|
||||||
goto error_out;
|
goto error_out;
|
||||||
if (*orig == '/') {
|
if (is_absolute_path(orig)) {
|
||||||
const char *work_tree = get_git_work_tree();
|
const char *work_tree = get_git_work_tree();
|
||||||
size_t len = strlen(work_tree);
|
size_t len = strlen(work_tree);
|
||||||
size_t total = strlen(sanitized) + 1;
|
size_t total = strlen(sanitized) + 1;
|
||||||
|
Reference in New Issue
Block a user