Commit ee0f24a0 authored by Julian Rother's avatar Julian Rother
Browse files

Threw realpath out of buildpath

In contrast to the commandline tool "realpath" the library function
fails for any path pointing to non-existing files (even if the parent
directory exists). This breaks most use-cases for this function.
parent cbecc66c
......@@ -4,18 +4,8 @@
char *buildpath(char *root, char *path)
char *tmp;
if (!path)
job_failed("Cannot build path: Value is empty");
if (!(root = realpath(root, 0)))
job_failed("Building path failed: %s", strerror(errno));
tmp = mprintf("%s/%s", root, path);
if (!(path = realpath(tmp, 0)))
job_failed("Building path failed: %s", strerror(errno));
if (strncmp(root, path, strlen(root)))
job_failed("Cannot build path: Path points out of root directory");
return path;
return mprintf("%s/%s", root, path);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment