summaryrefslogtreecommitdiffstats
path: root/urpm/cfg.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-05-21 16:55:47 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-05-21 16:55:47 +0000
commit067be74ea0e105a6be785779edc7b275977e9d60 (patch)
tree95dfe251a2014ee4b908e6fe5d15832348b20bd2 /urpm/cfg.pm
parentb5a3719a93a7ed0531414e342d5e6fd5aed9711e (diff)
downloadurpmi-067be74ea0e105a6be785779edc7b275977e9d60.tar
urpmi-067be74ea0e105a6be785779edc7b275977e9d60.tar.gz
urpmi-067be74ea0e105a6be785779edc7b275977e9d60.tar.bz2
urpmi-067be74ea0e105a6be785779edc7b275977e9d60.tar.xz
urpmi-067be74ea0e105a6be785779edc7b275977e9d60.zip
- urpmi.addmedia
o don't overwrite existing urpmi.cfg with an empty file when disk is full (#30945)
Diffstat (limited to 'urpm/cfg.pm')
-rw-r--r--urpm/cfg.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/urpm/cfg.pm b/urpm/cfg.pm
index 47761fec..23eab196 100644
--- a/urpm/cfg.pm
+++ b/urpm/cfg.pm
@@ -222,11 +222,7 @@ sub dump_config_raw {
substitute_back($m->{$field}, $prev_block && $prev_block->{$field});
};
- open my $f, '>', $file or do {
- $err = N("unable to write config file [%s]", $file);
- return 0;
- };
-
+ my @lines;
foreach my $m (@$blocks) {
my @l = map {
if (/^(update|ignore|synthesis|noreconfigure|static|virtual)$/) {
@@ -241,8 +237,14 @@ sub dump_config_raw {
my $name_url = $m->{name} ?
join(' ', map { quotespace($_) } $m->{name}, $substitute_back->($m, 'url')) . ' ' : '';
- print $f $name_url . "{\n", (map { " $_\n" } @l), "}\n\n";
+ push @lines, join("\n", $name_url . '{', (map { " $_" } @l), "}\n");
}
+
+ output_safe($file, join("\n", @lines)) or do {
+ $err = N("unable to write config file [%s]", $file);
+ return 0;
+ };
+
1;
}