summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2014-10-20 05:17:52 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2014-10-20 05:17:52 (GMT)
commitd8f25ca5f84413187ba4a41c09d552beeb2c0658 (patch) (side-by-side diff)
tree20ebadad1161af784104d7b42a7b1723af80ee82
parent8e38121f066cfde244782b05416f10e41803dd4c (diff)
downloaddnstools-d8f25ca5f84413187ba4a41c09d552beeb2c0658.tar.gz
dnstools-d8f25ca5f84413187ba4a41c09d552beeb2c0658.tar.bz2
whoseip: ensure database consistency during export
* whoseip/Whoseip/DB.pm (ipdb_export): Operate on locked database.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--whoseip/Whoseip/DB.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/whoseip/Whoseip/DB.pm b/whoseip/Whoseip/DB.pm
index 21a4192..a455a01 100644
--- a/whoseip/Whoseip/DB.pm
+++ b/whoseip/Whoseip/DB.pm
@@ -935,8 +935,8 @@ sub ipdb_export {
$fd = *STDOUT unless defined($fd);
+ ipdb_locker($dbf, lock => LOCK_EX);
my $ug = new Data::UUID;
-
print $fd "# Whoseip dump from file $dbf->{filename}\n";
print $fd "# UUID ".$ug->to_string($dbf->{uuid})."\n";
local $Data::Dumper::Indent = 0;
@@ -944,6 +944,7 @@ sub ipdb_export {
foreach my $off (values %{$dbf->{rootidx}}) {
ipdb_dump_page($dbf, $off, $fd);
}
+ ipdb_locker($dbf, lock => LOCK_UN);
}
=pod

Return to:

Send suggestions and report system problems to the System administrator.