diff options
author | Rob Landley <rob@landley.net> | 2012-06-01 13:50:41 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-06-01 13:50:41 -0500 |
commit | eec463764dbc2e83325695583a1b73bebc492a9e (patch) | |
tree | 645d3218ffdeb8293b7ba4f3b69466a69563382f /lib/lib.c | |
parent | 44785cd0821e909b1086c2368fe5d5bf742eca6f (diff) | |
download | toybox-eec463764dbc2e83325695583a1b73bebc492a9e.tar.gz |
Add xrealpath() at suggestion of Ashish Briggers.
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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); |