projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix set/badip so that it appends to the existing file
[spider.git]
/
perl
/
DXCIDR.pm
diff --git
a/perl/DXCIDR.pm
b/perl/DXCIDR.pm
index fdade7fc8989bae6d17fad741ff636604c0d2938..5a6272aa4747e0c813b96431b5932b5df22f1516 100644
(file)
--- a/
perl/DXCIDR.pm
+++ b/
perl/DXCIDR.pm
@@
-88,14
+88,13
@@
sub append
if ($suffix) {
my $fn = _fn() . ".$suffix";
if ($suffix) {
my $fn = _fn() . ".$suffix";
- my $
r = rand
;
- my $fh = IO::File->new (">>$fn.$r");
- if ($fh) {
+ my $
fh = IO::File->new
;
+ if ($fh->open("$fn", "a+")) {
+ $fh->seek(0, 2); # belt and braces !!
print $fh "$_\n" for @in;
$fh->close;
print $fh "$_\n" for @in;
$fh->close;
- move "$fn.$r", $fn;
} else {
} else {
- LogDbg('err', "DXCIDR::append error appending to $fn
.$r
$!");
+ LogDbg('err', "DXCIDR::append error appending to $fn $!");
}
} else {
LogDbg('err', "DXCIDR::append require badip suffix");
}
} else {
LogDbg('err', "DXCIDR::append require badip suffix");