author | Junio C Hamano <gitster@pobox.com> | |
Thu, 10 Feb 2011 00:41:16 +0000 (16:41 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 10 Feb 2011 00:41:16 +0000 (16:41 -0800) |
* cb/setup:
setup: translate symlinks in filename when using absolute paths
setup: translate symlinks in filename when using absolute paths
setup.c | patch | blob | history |
index dadc66659a4037b614b215b7f812c4df8969562b..021d0133ae1d6cf7f3a6a8284cb5b6e9a42dbe0d 100644 (file)
--- a/setup.c
+++ b/setup.c
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);