Ticket #7801: fix-eof-0.23.patch

File fix-eof-0.23.patch, 824 bytes (added by glemsom@…, 14 years ago)

Backported to 0.23

  • mythweb/modules/stream/stream_raw.pl

    old new  
    116116    while (sysread DATA, $buffer, $read_size ) {
    117117        print $buffer;
    118118        $size -= $read_size;
    119         if ($size == 0) {
    120             last;
     119        if ($size <= 0) {
     120            my $fileSize = -s $filename;
     121            my $filePos  = tell DATA;
     122            if ( ($fileSize - $filePos) > 0 ) {
     123                $size = $fileSize - $filePos;
     124            }
     125            else {
     126                last;
     127            }
    121128        }
    122129        if ($size < $read_size) {
    123130            $read_size = $size;
    124131        }
    125     }
     132        if ($read_size < 0) {
     133            $read_size = 0;
     134        }
     135   }
    126136    close DATA;
    127137
    128138    1;