diff lib/lib.c @ 585:1dcd7994abea

Add xrealpath() at suggestion of Ashish Briggers.
author Rob Landley <rob@landley.net>
date Fri, 01 Jun 2012 13:50:41 -0500
parents 5cc8a8fc08b4
children 7becb497c3c4
line wrap: on
line diff
--- a/lib/lib.c	Thu May 31 21:22:10 2012 -0500
+++ b/lib/lib.c	Fri Jun 01 13:50:41 2012 -0500
@@ -345,6 +345,14 @@
 	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);