summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-09-13 21:36:09 +0000
committerThierry Vignaud <tv@mandriva.org>2007-09-13 21:36:09 +0000
commit9ac51eac8d258532a8301fa162fbb306394fe521 (patch)
treecfe27d1d79fd84b8b5da955e7c2105a81ffdc69b
parent02cb7f9345ea63d7f2195d745850d0d395c03eb1 (diff)
downloaddrakx-9ac51eac8d258532a8301fa162fbb306394fe521.tar
drakx-9ac51eac8d258532a8301fa162fbb306394fe521.tar.gz
drakx-9ac51eac8d258532a8301fa162fbb306394fe521.tar.bz2
drakx-9ac51eac8d258532a8301fa162fbb306394fe521.tar.xz
drakx-9ac51eac8d258532a8301fa162fbb306394fe521.zip
(get_parent_uid) introduce it in order to be able to run a process
with regular user rights (#33522)
-rw-r--r--perl-install/common.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 0bb4dfe03..d48eca789 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -10,7 +10,7 @@ use run_program;
use Exporter;
our @ISA = qw(Exporter);
-our @EXPORT = qw($SECTORSIZE N P N_ check_for_xserver files_exist formatTime MB formatXiB makedev mandrake_release mandrake_release_info removeXiBSuffix require_root_capability setVirtual set_alternative set_l10n_sort set_permissions translate unmakedev);
+our @EXPORT = qw($SECTORSIZE N P N_ check_for_xserver files_exist formatTime MB formatXiB get_parent_uid makedev mandrake_release mandrake_release_info removeXiBSuffix require_root_capability setVirtual set_alternative set_l10n_sort set_permissions translate unmakedev);
# perl_checker: RE-EXPORT-ALL
push @EXPORT, @MDK::Common::EXPORT;
@@ -302,6 +302,10 @@ sub mandrake_release {
$f && chomp_(cat_("$o_dir$f"));
}
+sub get_parent_uid() {
+ cat_('/proc/' . getppid() . '/status') =~ /Uid:\s*(\d+)/ ? $1 : undef;
+}
+
sub wrap_command_for_root {
my ($name, @args) = @_;
([ 'consolehelper', $name ], @args);