Changeset 6e5562a in mainline for uspace/app/bdsh/cmds


Ignore:
Timestamp:
2017-03-31T19:57:38Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
80743a1
Parents:
a56cef9
Message:

Introduce vfs_link_path() and replace mkdir() with it

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

Legend:

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

    ra56cef9 r6e5562a  
    3636#include <str.h>
    3737#include <fcntl.h>
    38 #include <sys/stat.h>
    3938#include <vfs/vfs.h>
    4039#include <dirent.h>
     
    296295                                merge_paths(dest_path, PATH_MAX, src_dirname);
    297296
    298                                 if (mkdir(dest_path, 0) != 0) {
     297                                if (vfs_link_path(dest_path, KIND_DIRECTORY) != EOK) {
    299298                                        printf("Unable to create "
    300299                                            "dest directory %s\n", dest_path);
     
    310309                         * e.g. cp -r /src /data/new_dir_src
    311310                         */
    312                         if (mkdir(dest_path, 0) != 0) {
     311                        if (vfs_link_path(dest_path, KIND_DIRECTORY) != EOK) {
    313312                                printf("Unable to create "
    314313                                    "dest directory %s\n", dest_path);
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    ra56cef9 r6e5562a  
    3232#include <fcntl.h>
    3333#include <sys/types.h>
    34 #include <sys/stat.h>
    3534#include <getopt.h>
    3635#include <stdarg.h>
     
    9897
    9998        if (!create_parents) {
    100                 if (mkdir(path, 0) != 0) {
     99                ret = vfs_link_path(path, KIND_DIRECTORY);
     100                if (ret != EOK) {
    101101                        cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    102                             cmdname, path, str_error(errno));
     102                            cmdname, path, str_error(ret));
    103103                        ret = 1;
    104104                }
     
    136136                        path[prev_off] = 0;
    137137
    138                         if (mkdir(path, 0) != 0 && errno != EEXIST) {
     138                        ret = vfs_link_path(path, KIND_DIRECTORY);
     139                        if (ret != EOK && ret != EEXIST) {
    139140                                cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    140                                     cmdname, path, str_error(errno));
     141                                    cmdname, path, str_error(ret));
    141142                                ret = 1;
    142143                                goto leave;
     
    146147                }
    147148                /* Create the final directory. */
    148                 if (mkdir(path, 0) != 0) {
     149                ret = vfs_link_path(path, KIND_DIRECTORY);
     150                if (ret != EOK) {
    149151                        cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    150                             cmdname, path, str_error(errno));
     152                            cmdname, path, str_error(ret));
    151153                        ret = 1;
    152154                }
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    ra56cef9 r6e5562a  
    3333#include <fcntl.h>
    3434#include <sys/types.h>
    35 #include <sys/stat.h>
    3635#include <macros.h>
    3736#include <getopt.h>
Note: See TracChangeset for help on using the changeset viewer.