summaryrefslogtreecommitdiff
path: root/abspath.c
diff options
context:
space:
mode:
Diffstat (limited to 'abspath.c')
-rw-r--r--abspath.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/abspath.c b/abspath.c
index 8c6c76b05e..79ee310867 100644
--- a/abspath.c
+++ b/abspath.c
@@ -205,6 +205,19 @@ const char *real_path_if_valid(const char *path)
return strbuf_realpath(&realpath, path, 0);
}
+char *real_pathdup(const char *path)
+{
+ struct strbuf realpath = STRBUF_INIT;
+ char *retval = NULL;
+
+ if (strbuf_realpath(&realpath, path, 0))
+ retval = strbuf_detach(&realpath, NULL);
+
+ strbuf_release(&realpath);
+
+ return retval;
+}
+
/*
* Use this to get an absolute path from a relative one. If you want
* to resolve links, you should use real_path.