xbps_symlink_target: fix bb977c7
This commit is contained in:
parent
83b5b357cb
commit
4c655fd56a
13
lib/util.c
13
lib/util.c
@ -493,19 +493,20 @@ xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char *tgt)
|
||||
p = xbps_sanitize_path(lnkrs);
|
||||
assert(p);
|
||||
if ((strstr(p, "./")) && (p1 = realpath(p, NULL))) {
|
||||
if (strcmp(xhp->rootdir, "/") == 0)
|
||||
res = p1;
|
||||
else {
|
||||
if (strcmp(xhp->rootdir, "/") == 0) {
|
||||
res = strdup(p1);
|
||||
} else {
|
||||
res = strdup(p1 + strlen(xhp->rootdir));
|
||||
}
|
||||
free(p1);
|
||||
}
|
||||
}
|
||||
if (res == NULL) {
|
||||
if (strcmp(xhp->rootdir, "/") == 0)
|
||||
if (strcmp(xhp->rootdir, "/") == 0) {
|
||||
res = strdup(p);
|
||||
else
|
||||
} else {
|
||||
res = strdup(p + strlen(xhp->rootdir));
|
||||
}
|
||||
}
|
||||
assert(res);
|
||||
free(lnk);
|
||||
free(p);
|
||||
|
Loading…
Reference in New Issue
Block a user