libxbps: remove dangling symlinks properly.

This fixes removal of packages that contain multiple levels
of dangling symlinks, i.e faenza-icon-theme and probably others.

Close #23
This commit is contained in:
Juan RP
2019-05-17 08:19:21 +02:00
committed by Duncan Overbruck
parent 56aa77d51b
commit 9e2c00ee8b
3 changed files with 31 additions and 22 deletions

View File

@@ -190,7 +190,10 @@ remove_pkg_files(struct xbps_handle *xhp,
bool found;
xbps_dictionary_get_cstring_nocopy(obj, "file", &file);
snprintf(path, sizeof(path), "%s/%s", xhp->rootdir, file);
if (strcmp(xhp->rootdir, "/") == 0)
snprintf(path, sizeof(path), "%s", file);
else
snprintf(path, sizeof(path), "%s%s", xhp->rootdir, file);
if ((strcmp(key, "files") == 0) ||
(strcmp(key, "conf_files") == 0)) {