[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Sat Nov 26 10:16:42 UTC 2011


 tests/gpt-header-munge |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit eec497c07caaff5ef297f75ee87f5dff88cacd27
Author: Jim Meyering <meyering at redhat.com>
Date:   Fri Nov 11 09:50:51 2011 +0100

    maint: a little defensive programming in a test script
    
    * tests/gpt-header-munge: Use "local *F;" to limit scope of
    file handles.

diff --git a/tests/gpt-header-munge b/tests/gpt-header-munge
index 9b869dd..e7d3d43 100755
--- a/tests/gpt-header-munge
+++ b/tests/gpt-header-munge
@@ -64,6 +64,7 @@ sub partition_array_start_offset ($$)
 sub partition_array_crc ($$$)
 {
   my ($pri_or_backup, $n_pe, $in) = @_;
+  local *F;
   open F, '<', $in
     or die "$ME: failed to open $in: $!\n";
 
@@ -78,7 +79,6 @@ sub partition_array_crc ($$$)
   my $n = $n_pe * $pe_size;
   ($p = sysread F, $pe_buf, $n) && $p == $n
     or die "$ME: $in: failed to read $pri_or_backup partition array:($p:$n) $!\n";
-  close F;
 
   return crc32 $pe_buf;
 }
@@ -220,6 +220,7 @@ EOF
     or (warn "$ME: no file specified\n"), usage 1;
 
   my $in = $ARGV[0];
+  local *F;
   open F, '<', $in
     or die "$ME: failed to open $in: $!\n";
 



More information about the Parted-commits mailing list