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);
|
p = xbps_sanitize_path(lnkrs);
|
||||||
assert(p);
|
assert(p);
|
||||||
if ((strstr(p, "./")) && (p1 = realpath(p, NULL))) {
|
if ((strstr(p, "./")) && (p1 = realpath(p, NULL))) {
|
||||||
if (strcmp(xhp->rootdir, "/") == 0)
|
if (strcmp(xhp->rootdir, "/") == 0) {
|
||||||
res = p1;
|
res = strdup(p1);
|
||||||
else {
|
} else {
|
||||||
res = strdup(p1 + strlen(xhp->rootdir));
|
res = strdup(p1 + strlen(xhp->rootdir));
|
||||||
|
}
|
||||||
free(p1);
|
free(p1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
if (strcmp(xhp->rootdir, "/") == 0)
|
if (strcmp(xhp->rootdir, "/") == 0) {
|
||||||
res = strdup(p);
|
res = strdup(p);
|
||||||
else
|
} else {
|
||||||
res = strdup(p + strlen(xhp->rootdir));
|
res = strdup(p + strlen(xhp->rootdir));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
assert(res);
|
assert(res);
|
||||||
free(lnk);
|
free(lnk);
|
||||||
free(p);
|
free(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user