Changeset 00aece0 in mainline for uspace/lib/c/generic/io/io.c


Ignore:
Timestamp:
2012-02-18T16:47:38Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4449c6c
Parents:
bd5f3b7 (diff), f943dd3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    rbd5f3b7 r00aece0  
    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.