Ignore:
Timestamp:
2018-01-30T03:20:45Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a6cc679
Parents:
8bfb163 (diff), 6a5d05b (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 commit '6a5d05bd2551e64111bea4f9332dd7448c26ce84' into forwardport

Separate return value from error code in gen_irq_code*().

File:
1 edited

Legend:

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

    r8bfb163 r132ab5d1  
    7272static int cmp_files(const char *fn0, const char *fn1)
    7373{
    74         int rc = 0;
     74        int rc = EOK;
    7575        const char *fn[2] = {fn0, fn1};
    7676        int fd[2] = {-1, -1};
    7777        char buffer[2][CMP_BUFLEN];
    78         ssize_t offset[2];
     78        size_t offset[2];
    7979        aoff64_t pos[2] = {};
    8080
    8181        for (int i = 0; i < 2; i++) {
    82                 fd[i] = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ);
    83                 if (fd[i] < 0) {
    84                         rc = fd[i];
     82                rc = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ, &(fd[i]));
     83                if (rc != EOK) {
    8584                        printf("Unable to open %s\n", fn[i]);
    8685                        goto end;
     
    9089        do {
    9190                for (int i = 0; i < 2; i++) {
    92                         offset[i] = 0;
    93                         ssize_t size;
    94                         do {
    95                                 size = vfs_read(fd[i], &pos[i],
    96                                     buffer[i] + offset[i],
    97                                     CMP_BUFLEN - offset[i]);
    98                                 if (size < 0) {
    99                                         rc = size;
    100                                         printf("Error reading from %s\n",
    101                                             fn[i]);
    102                                         goto end;
    103                                 }
    104                                 offset[i] += size;
    105                         } while (size && offset[i] < CMP_BUFLEN);
     91                        rc = vfs_read(fd[i], &pos[i], buffer[i], CMP_BUFLEN,
     92                            &offset[i]);
     93                        if (rc != EOK) {
     94                                printf("Error reading from %s\n",
     95                                    fn[i]);
     96                                goto end;
     97                        }
    10698                }
    10799
    108100                if (offset[0] != offset[1] ||
    109101                    memcmp(buffer[0], buffer[1], offset[0]) != 0) {
    110                         rc = 1;
     102                        printf("Return 1\n");
     103                        rc = EBUSY;
    111104                        goto end;
    112105                }
     
    149142
    150143        rc = cmp_files(argv[optind], argv[optind + 1]);
    151         if (rc)
     144        if (rc != EOK)
    152145                return CMD_FAILURE;
    153146        else
Note: See TracChangeset for help on using the changeset viewer.