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