aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <p.jaroszynski@gmail.com> 2008-08-11 16:27:58 +0000
committerAvatar Piotr Jaroszyński <p.jaroszynski@gmail.com> 2008-08-11 16:36:13 +0000
commit8cf3a9dca43a6799a15d749b266e070525e7a46b (patch)
tree4e85eb31d4df247d46aa596ca690ddd2865e5a21
parentdb052e1a2087fd307ba611c33801f8a3f949fcce (diff)
downloadpaludis-8cf3a9dca43a6799a15d749b266e070525e7a46b.tar.gz
paludis-8cf3a9dca43a6799a15d749b266e070525e7a46b.tar.xz
Change get_new_ids_or_minus_one()s' logic to reset user and group ownership separately.
-rw-r--r--paludis/repositories/e/exndbam_repository.cc8
-rw-r--r--paludis/repositories/e/vdb_merger.cc8
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc21
3 files changed, 23 insertions, 14 deletions
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 251cce2..a22fd29 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -271,10 +271,10 @@ namespace
std::pair<uid_t, gid_t>
get_new_ids_or_minus_one(const Environment * const env, const FSEntry & f)
{
- if (f.owner() == env->reduced_uid() || f.group() == env->reduced_gid())
- return std::make_pair(0, 0);
- else
- return std::make_pair(-1, -1);
+ uid_t uid = (f.owner() == env->reduced_uid()) ? 0 : -1;
+ gid_t gid = (f.group() == env->reduced_gid()) ? 0 : -1;
+
+ return std::make_pair(uid, gid);
}
}
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index 6848cf6..80a473d 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -68,10 +68,10 @@ namespace
std::pair<uid_t, gid_t>
get_new_ids_or_minus_one(const Environment * const env, const FSEntry & f)
{
- if (f.owner() == env->reduced_uid() || f.group() == env->reduced_gid())
- return std::make_pair(0, 0);
- else
- return std::make_pair(-1, -1);
+ uid_t uid = (f.owner() == env->reduced_uid()) ? 0 : -1;
+ gid_t gid = (f.group() == env->reduced_gid()) ? 0 : -1;
+
+ return std::make_pair(uid, gid);
}
}
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 9e9175a..4fb5a10 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -229,13 +229,22 @@ namespace
std::pair<uid_t, gid_t>
get_new_ids_or_minus_one(const Environment * const env, const int rewrite_ids_over_to_root, const FSEntry & f)
{
- if (f.owner() == env->reduced_uid() || f.group() == env->reduced_gid())
- return std::make_pair(0, 0);
- else if ((-1 != rewrite_ids_over_to_root) && (f.owner() > static_cast<unsigned int>(rewrite_ids_over_to_root)
- || f.group() > static_cast<unsigned int>(rewrite_ids_over_to_root)))
- return std::make_pair(0, 0);
+ uid_t uid;
+ gid_t gid;
+
+ if (f.owner() == env->reduced_uid() || (rewrite_ids_over_to_root != -1
+ && f.owner() > static_cast<unsigned int>(rewrite_ids_over_to_root)))
+ uid = 0;
+ else
+ uid = -1;
+
+ if (f.group() == env->reduced_gid() || (rewrite_ids_over_to_root != -1
+ && f.group() > static_cast<unsigned int>(rewrite_ids_over_to_root)))
+ gid = 0;
else
- return std::make_pair(-1, -1);
+ gid = -1;
+
+ return std::make_pair(uid, gid);
}
}