aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 1b5488ef..612c29e1 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -345,6 +345,14 @@ char *xabspath(char *path)
return path;
}
+// Resolve all symlinks, returning malloc() memory.
+char *xrealpath(char *path)
+{
+ char *new = realpath(path, NULL);
+ if (!new) perror_exit("realpath '%s'", path);
+ return new;
+}
+
void xchdir(char *path)
{
if (chdir(path)) error_exit("chdir '%s'", path);