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


Ignore:
Timestamp:
2017-04-02T10:39:13Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9c4cf0d
Parents:
80743a1
Message:

Merge open() with posix_open() and provide vfs_lookup_open() instead

vfs_lookup_open() is really just a convenience wrapper around
vfs_lookup() and vfs_open().

File:
1 edited

Legend:

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

    r80743a1 rb19e892  
    3535#include <getopt.h>
    3636#include <str.h>
    37 #include <fcntl.h>
    3837#include <vfs/vfs.h>
    3938#include <dirent.h>
     
    383382                printf("Copying %s to %s\n", src, dest);
    384383
    385         if (-1 == (fd1 = open(src, O_RDONLY))) {
     384        fd1 = vfs_lookup_open(src, WALK_REGULAR, MODE_READ);
     385        if (fd1 < 0) {
    386386                printf("Unable to open source file %s\n", src);
    387387                return -1;
    388388        }
    389389
    390         if (-1 == (fd2 = open(dest, O_WRONLY | O_CREAT))) {
     390        fd2 = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE);
     391        if (fd2 < 0) {
    391392                printf("Unable to open destination file %s\n", dest);
    392393                close(fd1);
Note: See TracChangeset for help on using the changeset viewer.