Changeset f77c1c9 in mainline for uspace/app/bdsh/cmds


Ignore:
Timestamp:
2017-12-08T21:03:35Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c19a5a59
Parents:
c1694b6b
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-07 19:44:55)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:03:35)
Message:

Return VFS handles separately from error codes.

Location:
uspace/app/bdsh/cmds/modules
Files:
6 edited

Legend:

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

    rc1694b6b rf77c1c9  
    195195                /* Allow storing the whole UTF-8 character. */
    196196                blen = STR_BOUNDS(1);
    197         } else
    198                 fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
     197        } else {
     198                int rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);
     199                if (rc != EOK) {
     200                        fd = -1;
     201                }
     202        }
    199203       
    200204        if (fd < 0) {
  • uspace/app/bdsh/cmds/modules/cmp/cmp.c

    rc1694b6b rf77c1c9  
    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;
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    rc1694b6b rf77c1c9  
    394394                printf("Copying %s to %s\n", src, dest);
    395395
    396         fd1 = vfs_lookup_open(src, WALK_REGULAR, MODE_READ);
    397         if (fd1 < 0) {
     396        rc = vfs_lookup_open(src, WALK_REGULAR, MODE_READ, &fd1);
     397        if (rc != EOK) {
    398398                printf("Unable to open source file %s\n", src);
    399399                return -1;
    400400        }
    401401
    402         fd2 = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE);
    403         if (fd2 < 0) {
     402        rc = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, &fd2);
     403        if (rc != EOK) {
    404404                printf("Unable to open destination file %s\n", dest);
    405405                vfs_put(fd1);
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    rc1694b6b rf77c1c9  
    163163        file_name = argv[optind];
    164164
    165         fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE);
    166         if (fd < 0) {
     165        rc = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE, &fd);
     166        if (rc != EOK) {
    167167                printf("%s: failed to create file %s.\n", cmdname, file_name);
    168168                return CMD_FAILURE;
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    rc1694b6b rf77c1c9  
    149149        }
    150150
    151         fd = vfs_lookup(path, WALK_REGULAR);
    152         if (fd >= 0) {
     151        if (vfs_lookup(path, WALK_REGULAR, &fd) == EOK) {
    153152                vfs_put(fd);
    154153                return RM_FILE;
  • uspace/app/bdsh/cmds/modules/touch/touch.c

    rc1694b6b rf77c1c9  
    123123                if ((!no_create) ||
    124124                    ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) {
    125                         fd = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE);
     125                        int rc = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE, &fd);
     126                        if (rc != EOK) {
     127                                fd = -1;
     128                        }
    126129                }
    127130               
Note: See TracChangeset for help on using the changeset viewer.