Ticket #2430: httprequest.cpp.diff

File httprequest.cpp.diff, 653 bytes (added by troycauble@…, 15 years ago)

single file patch

  • httprequest.cpp

    old new  
    281281    {
    282282        __off64_t offset = llStart;
    283283        int       file   = open( sFileName.ascii(), O_RDONLY | O_LARGEFILE );
    284         sendfile64( getSocketHandle(), file, &offset, llSize );
     284        ssize_t sent = 0;
     285        do {
     286                // SSIZE_MAX should work in kernels 2.6.16 and later.
     287                // The loop is needed in any case.
     288                sent = sendfile64( getSocketHandle(), file, &offset,
     289                                (size_t)(llSize > INT_MAX ? INT_MAX : llSize));
     290                llSize -= sent;
     291        } while (sent >= 0 && llSize > 0);
    285292
    286293        close( file );
    287294    }