Package remove: disable file owner checks if euid==0.

All package files even not owned by root should be removed, so make sure
that those checks return success while being root.

This fixes package removal for polkit, that had /etc/polkit/rules.d
files owned by the polkitd user.
This commit is contained in:
Juan RP 2014-10-17 09:17:07 +02:00
parent b3d105cbc3
commit 1c20086896
2 changed files with 5 additions and 1 deletions

4
NEWS
View File

@ -1,5 +1,9 @@
xbps-0.42 (???):
* If removing a package and euid==0 do not check for file owner, being root
means that all files can be removed properly. This fixes package removal
when some files were not owned by root, rather by a system account.
* Fixed 65 issues found by Coverity scan. Defect density is now below 0.30
per 1000 lines of code.

View File

@ -65,7 +65,7 @@ check_remove_pkg_files(struct xbps_handle *xhp,
* enough to ensure the user has write permissions
* on the directory.
*/
if (!lstat(path, &st) && euid == st.st_uid) {
if (euid == 0 || (!lstat(path, &st) && euid == st.st_uid)) {
/* success */
continue;
}