Changes in uspace/app/bdsh/cmds/modules/cp/cp.c [07b7c48:6afc9d7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cp/cp.c
r07b7c48 r6afc9d7 27 27 */ 28 28 29 #include <errno.h> 29 30 #include <stdio.h> 30 31 #include <stdlib.h> … … 84 85 int r = stat(path, &s); 85 86 86 if (r )87 if (r != 0) 87 88 return TYPE_NONE; 88 89 else if (s.is_directory) … … 234 235 */ 235 236 if (force && !interactive) { 236 if (unlink(dest_path) ) {237 if (unlink(dest_path) != 0) { 237 238 printf("Unable to remove %s\n", 238 239 dest_path); … … 245 246 if (overwrite) { 246 247 printf("Overwriting file: %s\n", dest_path); 247 if (unlink(dest_path) ) {248 if (unlink(dest_path) != 0) { 248 249 printf("Unable to remove %s\n", dest_path); 249 250 goto exit; … … 294 295 merge_paths(dest_path, PATH_MAX, src_dirname); 295 296 296 if (mkdir(dest_path, 0) == -1) {297 if (mkdir(dest_path, 0) != 0) { 297 298 printf("Unable to create " 298 299 "dest directory %s\n", dest_path); … … 308 309 * e.g. cp -r /src /data/new_dir_src 309 310 */ 310 if (mkdir(dest_path, 0) ) {311 if (mkdir(dest_path, 0) != 0) { 311 312 printf("Unable to create " 312 313 "dest directory %s\n", dest_path); … … 405 406 } 406 407 407 while ((bytes = read _all(fd1, buff, blen)) > 0) {408 if ((bytes = write _all(fd2, buff, bytes)) < 0)408 while ((bytes = read(fd1, buff, blen)) > 0) { 409 if ((bytes = write(fd2, buff, bytes)) < 0) 409 410 break; 410 411 copied += bytes; … … 412 413 413 414 if (bytes < 0) { 414 printf("\nError copying %s, (%d)\n", src, bytes);415 printf("\nError copying %s, (%d)\n", src, errno); 415 416 copied = bytes; 416 417 } … … 457 458 argc = cli_count_args(argv); 458 459 459 for (c = 0, opt ind = 0, opt_ind = 0; c != -1;) {460 for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) { 460 461 c = getopt_long(argc, argv, "hvVfirb:", long_options, &opt_ind); 461 462 switch (c) {
Note:
See TracChangeset
for help on using the changeset viewer.