Ignore:
Timestamp:
2017-03-24T20:31:54Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8e9b2534
Parents:
c9e3692
Message:

Remove VFS_IN_SEEK from VFS

File:
1 edited

Legend:

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

    rc9e3692 r58898d1d  
    377377        int64_t copied = 0;
    378378        char *buff = NULL;
     379        aoff64_t posr = 0, posw = 0;
     380        struct stat st;
    379381
    380382        if (vb)
     
    392394        }
    393395
    394         total = lseek(fd1, 0, SEEK_END);
    395 
     396        if (fstat(fd1, &st) != EOK) {
     397                printf("Unable to fstat %d\n", fd1);
     398                close(fd1);
     399                close(fd2);
     400                return -1;     
     401        }
     402
     403        total = st.size;
    396404        if (vb)
    397405                printf("%" PRIu64 " bytes to copy\n", total);
    398 
    399         lseek(fd1, 0, SEEK_SET);
    400406
    401407        if (NULL == (buff = (char *) malloc(blen))) {
     
    406412        }
    407413
    408         while ((bytes = read(fd1, buff, blen)) > 0) {
    409                 if ((bytes = write(fd2, buff, bytes)) < 0)
     414        while ((bytes = read(fd1, &posr, buff, blen)) > 0) {
     415                if ((bytes = write(fd2, &posw, buff, bytes)) < 0)
    410416                        break;
    411417                copied += bytes;
Note: See TracChangeset for help on using the changeset viewer.