Ticket #3944: readline_fix.patch

File readline_fix.patch, 825 bytes (added by salty-horse, 16 years ago)
  • common/file.cpp

     
    469469                return 0;
    470470
    471471        real_len = fread(ptr2, 1, len, (FILE *)_handle);
    472         if (real_len < len) {
     472        if (real_len < len && !eof()) {
    473473                _ioFailed = true;
    474474        }
    475475
  • common/stream.cpp

     
    171171                if (ioFailed() || (len == 0 && eos()))
    172172                        return 0;
    173173
     174                // If end-of-file occurs and characters have been read,
     175                // return them.
     176                if (eos()) {
     177                        *p = 0;
     178                        return buf;
     179                }
     180
    174181                // Check for CR or CR/LF
    175182                // * DOS and Windows use CRLF line breaks
    176183                // * Unix and OS X use LF line breaks