summaryrefslogtreecommitdiffstats
path: root/urpm/util.pm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm/util.pm')
-rw-r--r--urpm/util.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/urpm/util.pm b/urpm/util.pm
index 4dbad1cc..563d3118 100644
--- a/urpm/util.pm
+++ b/urpm/util.pm
@@ -187,7 +187,20 @@ sub uniq_(&@) {
sub output_safe {
my ($file, $content, $o_backup_ext) = @_;
-
+
+ #- The file must be world-readable, else mgaapplet and urpm* commands run as
+ #- a normal user won't be able to read it. We enforce umask here in the case
+ #- where the msec security level is set to 'secure' (which means umask 077)
+ #- or where we are run from a gdm-x-session (mga#24636)
+ my $old_umask = umask 0022;
+ my $retval = output_safe_($file, $content, $o_backup_ext);
+ umask $old_umask;
+ $retval;
+}
+
+sub output_safe_ {
+ my ($file, $content, $o_backup_ext) = @_;
+
open(my $f, '>', "$file.new") or return;
print $f $content or return;
close $f or return;