if (!cwd)
return NULL;
- return path_make_absolute(p, cwd);
+ return strjoin(cwd, "/", p, NULL);
}
int path_make_relative(const char *from_dir, const char *to_path, char **_r) {
} else {
/* canonicalized path goes outside of
* prefix, keep the original path instead */
+ free(u);
u = orig;
orig = NULL;
}
assert(path);
if (!isempty(root))
- return strjoin(root, "/",
+ return strjoin(root, endswith(root, "/") ? "" : "/",
path[0] == '/' ? path+1 : path,
- rest ? "/" : NULL,
+ rest ? (endswith(path, "/") ? "" : "/") : NULL,
rest && rest[0] == '/' ? rest+1 : rest,
NULL);
else
return strjoin(path,
- rest ? "/" : NULL,
+ rest ? (endswith(path, "/") ? "" : "/") : NULL,
rest && rest[0] == '/' ? rest+1 : rest,
NULL);
}
return r;
h.handle.handle_bytes = MAX_HANDLE_SZ;
- r = name_to_handle_at(AT_FDCWD, parent, &h.handle, &mount_id_parent, 0);
+ r = name_to_handle_at(AT_FDCWD, parent, &h.handle, &mount_id_parent, AT_SYMLINK_FOLLOW);
if (r < 0) {
/* The parent can't do name_to_handle_at() but the
* directory we are interested in can? If so, it must
if (r < 0)
return r;
- r = lstat(parent, &b);
+ r = stat(parent, &b);
if (r < 0)
return -errno;