From: Dan Boger Date: Thu, 16 Jul 2009 23:50:45 +0000 (-0700) Subject: r673 - don't allow monitor_child to process partial files. This is how it should... X-Git-Url: https://git.sommitrealweird.co.uk/twirssi-net-twitter-lite.git/commitdiff_plain/2a7a572495dec25cd287bf5186b9cc9067c18018?ds=sidebyside r673 - don't allow monitor_child to process partial files. This is how it should have been written from the start. --- diff --git a/twirssi.pl b/twirssi.pl index 281c124..daa01af 100644 --- a/twirssi.pl +++ b/twirssi.pl @@ -11,7 +11,7 @@ $Data::Dumper::Indent = 1; use vars qw($VERSION %IRSSI); $VERSION = "2.2.5beta"; -my ($REV) = '$Rev: 663 $' =~ /(\d+)/; +my ($REV) = '$Rev: 673 $' =~ /(\d+)/; %IRSSI = ( authors => 'Dan Boger', contact => 'zigdon@gmail.com', @@ -20,7 +20,7 @@ my ($REV) = '$Rev: 663 $' =~ /(\d+)/; . 'Can optionally set your bitlbee /away message to same', license => 'GNU GPL v2', url => 'http://twirssi.com', - changed => '$Date: 2009-07-08 16:25:21 -0700 (Wed, 08 Jul 2009) $', + changed => '$Date: 2009-07-16 16:50:30 -0700 (Thu, 16 Jul 2009) $', ); my $window; @@ -758,7 +758,7 @@ sub get_updates { my $pid = fork(); if ($pid) { # parent - Irssi::timeout_add_once( 5000, 'monitor_child', [ $filename, 0 ] ); + Irssi::timeout_add_once( 5000, 'monitor_child', [ "$filename.done", 0 ] ); Irssi::pidwait_add($pid); } elsif ( defined $pid ) { # child close STDIN; @@ -800,6 +800,7 @@ sub get_updates { print $fh "-- $new_poll"; } close $fh; + rename $filename, "$filename.done"; exit; } else { &ccrap("Failed to fork for updating: $!");