]> git.donarmstrong.com Git - debbugs.git/commitdiff
properly check close and closedir
authorDon Armstrong <don@donarmstrong.com>
Tue, 3 Jan 2017 18:16:22 +0000 (10:16 -0800)
committerDon Armstrong <don@donarmstrong.com>
Tue, 3 Jan 2017 18:16:22 +0000 (10:16 -0800)
 - Thanks to Ian Jackson for noticing that we weren't properly checking
   whether the decompression program properly exited by checking the
   return value of close(). See
   22635.45523.288493.760480@chiark.greenend.org.uk for discussion

examples/debian/versions/build-versions-db

index 2d52c61c0724c71c7855d7b06dbcc79197d97eb3..30985872c1a05145ea9bd066c56aae9d4bd23ebf 100755 (executable)
@@ -161,6 +161,8 @@ sub read_packages {
        update_package_version($db,$db2,$dist,$arch,$pkg,$ver,$time) unless
            $extra_source_only;
     }
+    close($PACKAGES) or
+       die "Error while closing ${packages}: $!";
 }
 
 
@@ -208,7 +210,8 @@ for my $suite (@{$suites}) {
            read_packages($db,$db2,$packages, $viscomponent,$arch,$suite);
        }
 
-       closedir $COMPONENT;
+       closedir $COMPONENT or
+           die "Unable to closedir $componentdir: $!";
     }
 }
 }