Make sure that all symlinks in a package are removed, not just dangling symlinks.

This commit is contained in:
Juan RP
2014-01-12 17:10:07 +01:00
parent 16bfc5e61d
commit 292be5c420
3 changed files with 42 additions and 19 deletions

View File

@ -54,13 +54,11 @@ xbps_remove_pkg_files(struct xbps_handle *xhp,
const char *key,
const char *pkgver)
{
struct stat st;
xbps_array_t array;
xbps_object_iterator_t iter;
xbps_object_t obj;
const char *file, *sha256, *curobj = NULL;
char *path = NULL;
char buf[PATH_MAX];
int rv = 0;
bool found;
@ -137,22 +135,6 @@ xbps_remove_pkg_files(struct xbps_handle *xhp,
free(path);
break;
}
} else if (strcmp(key, "links") == 0) {
/*
* All regular files from package were removed at this
* point, so we will only remove dangling symlinks.
*/
if (realpath(path, buf) == NULL) {
if (errno != ENOENT && errno != ELOOP) {
free(path);
rv = errno;
break;
}
}
if (stat(buf, &st) == 0) {
free(path);
continue;
}
}
/*
* Make sure to not remove any symlink of root directory.