Changeset bad8d41 in mainline for uspace/app/bdsh


Ignore:
Timestamp:
2017-12-21T20:24:54Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Parents:
f04b5b3
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-21 18:24:59)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-21 20:24:54)
Message:

The "not-so-obvious" error handling tweaks.

Location:
uspace/app/bdsh
Files:
3 edited

Legend:

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

    rf04b5b3 rbad8d41  
    101101                    memcmp(buffer[0], buffer[1], offset[0]) != 0) {
    102102                        printf("Return 1\n");
    103                         rc = 1;
     103                        rc = EBUSY;
    104104                        goto end;
    105105                }
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    rf04b5b3 rbad8d41  
    266266
    267267                /* call copy_file and exit */
    268                 rc = (copy_file(src, dest_path, blen, vb) < 0);
     268                if (copy_file(src, dest_path, blen, vb) < 0) {
     269                        rc = EIO;
     270                }
    269271
    270272        } else if (src_type == TYPE_DIR) {
     
    434436        if (rc != EOK) {
    435437                printf("\nError copying %s: %s\n", src, str_error(rc));
    436                 return rc;
     438                return -1;
    437439        }
    438440
     
    442444        if (buff)
    443445                free(buff);
    444         return rc;
     446        if (rc != EOK) {
     447                return -1;
     448        } else {
     449                return 0;
     450        }
    445451}
    446452
     
    473479        int force = 0, interactive = 0;
    474480        int c, opt_ind;
    475         int64_t ret;
     481        int ret;
    476482
    477483        con = console_init(stdin, stdout);
  • uspace/app/bdsh/input.c

    rf04b5b3 rbad8d41  
    7373       
    7474        char *cmd[WORD_MAX];
    75         int rc = 0;
     75        int rc = EOK;
    7676        tokenizer_t tok;
    7777        unsigned int i, pipe_count, processed_pipes;
     
    8282        if (usr->line == NULL) {
    8383                free(tokens_buf);
    84                 return CL_EFAIL;
     84                return EINVAL;
    8585        }
    8686
     
    198198        }
    199199
    200         rc = run_command(cmd, usr, &new_iostate);
     200        if (run_command(cmd, usr, &new_iostate) == 0) {
     201                rc = EOK;
     202        } else {
     203                rc = EINVAL;
     204        }
    201205       
    202206finit_with_files:
Note: See TracChangeset for help on using the changeset viewer.