X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=setup.c;h=021d0133ae1d6cf7f3a6a8284cb5b6e9a42dbe0d;hb=ffe6dc081aa23d56e6306d143d99ca508db38c5e;hp=dadc66659a4037b614b215b7f812c4df8969562b;hpb=a8e4a5943a63c8fd4a3a9b70ccf4608bcc973707;p=git.git diff --git a/setup.c b/setup.c index dadc66659..021d0133a 100644 --- a/setup.c +++ b/setup.c @@ -7,10 +7,13 @@ static int inside_work_tree = -1; char *prefix_path(const char *prefix, int len, const char *path) { const char *orig = path; - char *sanitized = xmalloc(len + strlen(path) + 1); - if (is_absolute_path(orig)) - strcpy(sanitized, path); - else { + char *sanitized; + if (is_absolute_path(orig)) { + const char *temp = make_absolute_path(path); + sanitized = xmalloc(len + strlen(temp) + 1); + strcpy(sanitized, temp); + } else { + sanitized = xmalloc(len + strlen(path) + 1); if (len) memcpy(sanitized, prefix, len); strcpy(sanitized + len, path);