xbps_symlink_target: fix bb977c7 (v2).

This commit is contained in:
Juan RP 2015-12-21 17:50:13 +01:00
parent 4c655fd56a
commit d984eeeb47

View File

@ -498,18 +498,20 @@ xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char *tgt)
} else {
res = strdup(p1 + strlen(xhp->rootdir));
}
assert(res);
free(p1);
free(p);
}
if (res == NULL) {
if (strcmp(xhp->rootdir, "/") == 0) {
res = strdup(p);
res = p;
} else {
res = strdup(p + strlen(xhp->rootdir));
free(p);
}
}
assert(res);
free(lnk);
free(p);
} else {
/* absolute */
res = lnk;