Changeset 2815505 in mainline for uspace/app/bdsh/cmds/modules/cp/cp.c


Ignore:
Timestamp:
2011-03-24T00:28:35Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5f9f37d, b946bf83
Parents:
71af5a4
Message:

cp should update the buffer address if multiple write()'s are needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    r71af5a4 r2815505  
    108108        for (;;) {
    109109                ssize_t res;
     110                size_t written = 0;
    110111
    111112                bytes = read(fd1, buff, blen);
     
    120121                         * returned less data than requested.
    121122                         */
    122                         bytes = write(fd2, buff, res);
     123                        bytes = write(fd2, buff + written, res);
    123124                        if (bytes < 0)
    124125                                goto err;
     126                        written += bytes;
    125127                        res -= bytes;
    126128                } while (res > 0);
Note: See TracChangeset for help on using the changeset viewer.