Changeset 58898d1d in mainline for uspace/app/bdsh/cmds/modules/cp/cp.c
- Timestamp:
- 2017-03-24T20:31:54Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e9b2534
- Parents:
- c9e3692
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cp/cp.c
rc9e3692 r58898d1d 377 377 int64_t copied = 0; 378 378 char *buff = NULL; 379 aoff64_t posr = 0, posw = 0; 380 struct stat st; 379 381 380 382 if (vb) … … 392 394 } 393 395 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; 396 404 if (vb) 397 405 printf("%" PRIu64 " bytes to copy\n", total); 398 399 lseek(fd1, 0, SEEK_SET);400 406 401 407 if (NULL == (buff = (char *) malloc(blen))) { … … 406 412 } 407 413 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) 410 416 break; 411 417 copied += bytes;
Note:
See TracChangeset
for help on using the changeset viewer.