Changeset ff381a7 in mainline for uspace/app/bdsh/cmds/modules/cp/cp.c


Ignore:
Timestamp:
2015-11-02T20:54:19Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d8513177
Parents:
3feeab2 (diff), 5265eea4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r3feeab2 rff381a7  
    2727 */
    2828
     29#include <errno.h>
    2930#include <stdio.h>
    3031#include <stdlib.h>
     
    8485        int r = stat(path, &s);
    8586
    86         if (r)
     87        if (r != 0)
    8788                return TYPE_NONE;
    8889        else if (s.is_directory)
     
    234235                         */
    235236                        if (force && !interactive) {
    236                                 if (unlink(dest_path)) {
     237                                if (unlink(dest_path) != 0) {
    237238                                        printf("Unable to remove %s\n",
    238239                                            dest_path);
     
    245246                                if (overwrite) {
    246247                                        printf("Overwriting file: %s\n", dest_path);
    247                                         if (unlink(dest_path)) {
     248                                        if (unlink(dest_path) != 0) {
    248249                                                printf("Unable to remove %s\n", dest_path);
    249250                                                goto exit;
     
    294295                                merge_paths(dest_path, PATH_MAX, src_dirname);
    295296
    296                                 if (mkdir(dest_path, 0) == -1) {
     297                                if (mkdir(dest_path, 0) != 0) {
    297298                                        printf("Unable to create "
    298299                                            "dest directory %s\n", dest_path);
     
    308309                         * e.g. cp -r /src /data/new_dir_src
    309310                         */
    310                         if (mkdir(dest_path, 0)) {
     311                        if (mkdir(dest_path, 0) != 0) {
    311312                                printf("Unable to create "
    312313                                    "dest directory %s\n", dest_path);
     
    405406        }
    406407
    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)
    409410                        break;
    410411                copied += bytes;
     
    412413
    413414        if (bytes < 0) {
    414                 printf("\nError copying %s, (%d)\n", src, bytes);
     415                printf("\nError copying %s, (%d)\n", src, errno);
    415416                copied = bytes;
    416417        }
Note: See TracChangeset for help on using the changeset viewer.