Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 2f72c67a in mainline


Ignore:
Timestamp:
2011-09-14T21:04:01Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
c82047d
Parents:
05fb96b
Message:

_fflushbuf() must reset buffer head and tail even when bytes_used == 0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/io.c

    r05fb96b r2f72c67a  
    418418
    419419        bytes_used = stream->buf_head - stream->buf_tail;
    420         if (bytes_used == 0)
    421                 return;
    422420
    423421        /* If buffer has prefetched read data, we need to seek back. */
    424         if (stream->buf_state == _bs_read)
     422        if (bytes_used > 0 && stream->buf_state == _bs_read)
    425423                lseek(stream->fd, - (ssize_t) bytes_used, SEEK_CUR);
    426424
    427425        /* If buffer has unwritten data, we need to write them out. */
    428         if (stream->buf_state == _bs_write)
     426        if (bytes_used > 0 && stream->buf_state == _bs_write)
    429427                (void) _fwrite(stream->buf_tail, 1, bytes_used, stream);
    430428
Note: See TracChangeset for help on using the changeset viewer.