[poe-commits] poe/POE/Wheel FollowTail.pm,1.45,1.46
Brought to you by:
rcaputo
From: <rc...@us...> - 2003-08-10 19:14:48
|
Update of /cvsroot/poe/poe/POE/Wheel In directory sc8-pr-cvs1:/tmp/cvs-serv24527 Modified Files: FollowTail.pm Log Message: Perform a proper fix for the file size shrinkage. Rather than reopen the file unconditionally, seek back to the start of it. Index: FollowTail.pm =================================================================== RCS file: /cvsroot/poe/poe/POE/Wheel/FollowTail.pm,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** FollowTail.pm 10 Aug 2003 18:59:55 -0000 1.45 --- FollowTail.pm 10 Aug 2003 19:14:45 -0000 1.46 *************** *** 92,95 **** --- 92,98 ---- # FIFOs (named pipes) are opened R/W so they don't report EOF. + # TODO Make this nonfatal, in case the file doesn't exist but will + # later. For example, the file may be caught in the middle of a + # rotation. if (-p $filename) { open $handle, "+<$filename" or *************** *** 321,328 **** if (@new_stat) { ! # File shrank. Consider it a reset. if ($new_stat[7] < $last_stat->[7]) { $$event_reset and $k->call($ses, $$event_reset, $unique_id); $last_stat->[7] = $new_stat[7]; } --- 324,333 ---- if (@new_stat) { ! # File shrank. Consider it a reset. Seek to the top of ! # the file. if ($new_stat[7] < $last_stat->[7]) { $$event_reset and $k->call($ses, $$event_reset, $unique_id); $last_stat->[7] = $new_stat[7]; + sysseek($handle, 0, SEEK_SET); } *************** *** 331,336 **** $new_stat[0] != $last_stat->[0] or # inode's device $new_stat[6] != $last_stat->[6] or # device type ! $new_stat[3] != $last_stat->[3] or # number of links ! $new_stat[7] < $last_stat->[7] # file shrank ) { --- 336,340 ---- $new_stat[0] != $last_stat->[0] or # inode's device $new_stat[6] != $last_stat->[6] or # device type ! $new_stat[3] != $last_stat->[3] # number of links ) { |