Improve detection of target file in relative symlinks.

If xbps-create(8) did not guess the target file of relative symlinks for
some reason, just compare the current symlink and what's stored as is,
without converting it to absolute.

This might happen with dangling relative symlinks or existing binary
packages that were not created with a newer xbps-create(8).
This commit is contained in:
Juan RP
2015-02-19 10:24:24 +01:00
parent 05f879ec09
commit 67eba7d912
4 changed files with 20 additions and 9 deletions

View File

@@ -211,14 +211,14 @@ remove_pkg_files(struct xbps_handle *xhp,
const char *target = NULL;
char *lnk;
lnk = xbps_symlink_target(xhp, path);
xbps_dictionary_get_cstring_nocopy(obj, "target", &target);
assert(target);
lnk = xbps_symlink_target(xhp, path, target);
if (lnk == NULL) {
xbps_dbg_printf(xhp, "[remove] %s "
"symlink_target: %s\n", path, strerror(errno));
continue;
}
xbps_dictionary_get_cstring_nocopy(obj, "target", &target);
assert(target);
if (strcmp(lnk, target)) {
xbps_dbg_printf(xhp, "[remove] %s symlink "
"modified (stored %s current %s)\n", path,