summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2016-01-04 21:42:29 +0000
committerNiels Thykier <niels@thykier.net>2016-01-04 21:42:29 +0000
commit240bc401f2202744654d472a13ddbd73e0c733cc (patch)
tree0367c28a601b2137ceda49a0986c7035390ab60b
parentdf52ff1efcb059579106f9f1fa3233708b5c657a (diff)
downloaddebhelper-240bc401f2202744654d472a13ddbd73e0c733cc.tar.gz
dh_icons: Add missing error check and close
Signed-off-by: Niels Thykier <niels@thykier.net>
-rwxr-xr-xdh_icons5
1 files changed, 3 insertions, 2 deletions
diff --git a/dh_icons b/dh_icons
index dd305f5c..b6caaf3c 100755
--- a/dh_icons
+++ b/dh_icons
@@ -50,8 +50,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
my $icondir="$tmp$baseicondir";
if (-d $icondir) {
my @dirlist;
- opendir(DIRHANDLE, $icondir);
- while (my $subdir = readdir(DIRHANDLE)) {
+ opendir(my $dirfd, $icondir) or error("Cannot opendir($icondir): $!");
+ while (my $subdir = readdir($dirfd)) {
next if $subdir =~ /^\./;
next if $subdir eq "gnome";
next if $subdir eq "hicolor";
@@ -61,6 +61,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
}, "$icondir/$subdir" ;
push @dirlist, "$baseicondir/$subdir" if $needs_cache;
}
+ closedir($dirfd);
if (@dirlist and ! $dh{NOSCRIPTS}) {
my $list=join(" ", sort @dirlist);
autoscript($package,"postinst","postinst-icons","s%#DIRLIST#%$list%g");