Changes in uspace/app/bdsh/cmds/modules/cp/cp.c [39330200:8e3498b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cp/cp.c
r39330200 r8e3498b 28 28 29 29 #include <errno.h> 30 #include <str_error.h>31 30 #include <stdio.h> 32 31 #include <stdlib.h> … … 80 79 static dentry_type_t get_type(const char *path) 81 80 { 82 vfs_stat_t s;83 84 errno_t r = vfs_stat_path(path, &s);81 struct stat s; 82 83 int r = vfs_stat_path(path, &s); 85 84 86 85 if (r != EOK) … … 176 175 } 177 176 178 static errno_t do_copy(const char *src, const char *dest,177 static int do_copy(const char *src, const char *dest, 179 178 size_t blen, int vb, int recursive, int force, int interactive) 180 179 { 181 errno_t rc = EOK;180 int rc = EOK; 182 181 char dest_path[PATH_MAX]; 183 182 char src_path[PATH_MAX]; … … 266 265 267 266 /* call copy_file and exit */ 268 if (copy_file(src, dest_path, blen, vb) < 0) { 269 rc = EIO; 270 } 267 rc = (copy_file(src, dest_path, blen, vb) < 0); 271 268 272 269 } else if (src_type == TYPE_DIR) { … … 340 337 */ 341 338 while ((dp = readdir(dir))) { 342 vfs_stat_t src_s;343 vfs_stat_t dest_s;339 struct stat src_s; 340 struct stat dest_s; 344 341 345 342 char src_dent[PATH_MAX]; … … 388 385 int fd1, fd2; 389 386 size_t rbytes, wbytes; 390 errno_t rc;387 int rc; 391 388 off64_t total; 392 389 char *buff = NULL; 393 390 aoff64_t posr = 0, posw = 0; 394 vfs_stat_t st;391 struct stat st; 395 392 396 393 if (vb) 397 394 printf("Copying %s to %s\n", src, dest); 398 395 399 rc = vfs_lookup_open(src, WALK_REGULAR, MODE_READ, &fd1);400 if ( rc != EOK) {396 fd1 = vfs_lookup_open(src, WALK_REGULAR, MODE_READ); 397 if (fd1 < 0) { 401 398 printf("Unable to open source file %s\n", src); 402 399 return -1; 403 400 } 404 401 405 rc = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, &fd2);406 if ( rc != EOK) {402 fd2 = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE); 403 if (fd2 < 0) { 407 404 printf("Unable to open destination file %s\n", dest); 408 405 vfs_put(fd1); … … 435 432 436 433 if (rc != EOK) { 437 printf("\nError copying %s : %s\n", src, str_error(rc));438 return -1;434 printf("\nError copying %s, (%d)\n", src, rc); 435 return rc; 439 436 } 440 437 … … 444 441 if (buff) 445 442 free(buff); 446 if (rc != EOK) { 447 return -1; 448 } else { 449 return 0; 450 } 443 return rc; 451 444 } 452 445 … … 479 472 int force = 0, interactive = 0; 480 473 int c, opt_ind; 481 errno_t ret;474 int64_t ret; 482 475 483 476 con = console_init(stdin, stdout);
Note:
See TracChangeset
for help on using the changeset viewer.