summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm/ldap.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/urpm/ldap.pm b/urpm/ldap.pm
index 5c5edbb3..281ad56c 100644
--- a/urpm/ldap.pm
+++ b/urpm/ldap.pm
@@ -40,14 +40,12 @@ sub write_ldap_cache($$) {
# FIXME what perm for cache ?
-d $ldap_cache or mkdir $ldap_cache
or die N("Cannot create ldap cache directory");
- open my $cache, ">", "$ldap_cache/$medium->{name}"
- or die N("Cannot write cache file for ldap\n");
- print $cache "# internal cache file for disconnect ldap operation, do not edit\n";
- foreach (keys %$medium) {
- defined $medium->{$_} or next;
- print $cache "$_ = $medium->{$_}\n";
- }
- close $cache;
+ output_safe("$ldap_cache/$medium->{name}",
+ join("\n",
+ "# internal cache file for disconnect ldap operation, do not edit",
+ map { "$_ = $medium->{$_}" } grep { $medium->{$_} } keys %$medium
+ )
+ ) or die N("Cannot write cache file for ldap\n");
return 1;
}