aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments/paludis
diff options
context:
space:
mode:
authorAvatar Benedikt Morbach <moben@exherbo.org> 2018-04-09 17:31:55 +0200
committerAvatar Benedikt Morbach <moben@exherbo.org> 2018-04-09 19:39:10 +0200
commit917cc160a14ee45801ff227f5678854dc4c0c06e (patch)
tree129559555b7232076862efa38015ab256ac16b15 /paludis/environments/paludis
parent589fe420875f39119e1d3d8eff9eb0ac0889816b (diff)
downloadpaludis-917cc160a14ee45801ff227f5678854dc4c0c06e.tar.gz
paludis-917cc160a14ee45801ff227f5678854dc4c0c06e.tar.xz
add reduced_username() to Environment
Diffstat (limited to 'paludis/environments/paludis')
-rw-r--r--paludis/environments/paludis/paludis_environment.cc10
-rw-r--r--paludis/environments/paludis/paludis_environment.hh3
2 files changed, 13 insertions, 0 deletions
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index bbb162861..1667c9cc8 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -294,6 +294,16 @@ PaludisEnvironment::mirrors(const std::string & m) const
return _imp->config->mirrors_conf()->query(m);
}
+std::string
+PaludisEnvironment::reduced_username() const
+{
+ uid_t u(getuid());
+ if (0 == u)
+ return _imp->config->reduced_username();
+ else
+ return get_user_name(u);
+}
+
uid_t
PaludisEnvironment::reduced_uid() const
{
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index 080bf0de7..701537594 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -85,6 +85,9 @@ namespace paludis
virtual std::shared_ptr<const FSPathSequence> hook_dirs() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual std::string reduced_username() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
virtual uid_t reduced_uid() const
PALUDIS_ATTRIBUTE((warn_unused_result));