$self->open( $obj ) if !defined $obj->_fh;
- unless ( $obj->{base_offset} ) {
- my $fh = $obj->_fh;
-
- flock $fh, LOCK_EX;
+ my $fh = $obj->_fh;
+ flock $fh, LOCK_EX;
+ unless ( $obj->{base_offset} ) {
seek($fh, 0 + $obj->_root->{file_offset}, SEEK_SET);
my $signature;
my $bytes_read = read( $fh, $signature, length(SIG_FILE));
$obj->_throw_error("File type mismatch");
}
}
-
- flock $fh, LOCK_UN;
}
#XXX We have to make sure we don't mess up when autoflush isn't turned on
$obj->_root->{end} = $stats[7];
}
+ flock $fh, LOCK_UN;
+
return 1;
}