Ignore:
File:
1 edited

Legend:

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

    r6afc9d7 rd96d9bc  
    3030#include <stdio.h>
    3131#include <stdlib.h>
    32 #include <unistd.h>
    33 #include <fcntl.h>
    3432#include <dirent.h>
    3533#include <getopt.h>
    3634#include <mem.h>
    3735#include <str.h>
     36#include <vfs/vfs.h>
    3837
    3938#include "config.h"
     
    110109        memset(rm->cwd, 0, PATH_MAX);
    111110
    112         chdir(".");
    113 
    114         if (NULL == (getcwd(rm->owd, PATH_MAX)))
     111        vfs_cwd_set(".");
     112
     113        if (EOK != vfs_cwd_get(rm->owd, PATH_MAX))
    115114                return 0;
    116115
     
    132131static unsigned int rm_single(const char *path)
    133132{
    134         if (unlink(path) != 0) {
     133        if (vfs_unlink_path(path) != EOK) {
    135134                cli_error(CL_EFAIL, "rm: could not remove file %s", path);
    136135                return 1;
     
    150149        }
    151150
    152         fd = open(path, O_RDONLY);
     151        fd = vfs_lookup(path, WALK_REGULAR);
    153152        if (fd >= 0) {
    154                 close(fd);
     153                vfs_put(fd);
    155154                return RM_FILE;
    156155        }
     
    201200
    202201        /* First see if it will just go away */
    203         rc = rmdir(path);
    204         if (rc == 0)
     202        rc = vfs_unlink_path(path);
     203        if (rc == EOK)
    205204                return 0;
    206205
     
    209208
    210209        /* Delete directory */
    211         rc = rmdir(path);
    212         if (rc == 0)
    213                 return errno;
     210        rc = vfs_unlink_path(path);
     211        if (rc == EOK)
     212                return EOK;
    214213
    215214        cli_error(CL_ENOTSUP, "Can not remove %s", path);
Note: See TracChangeset for help on using the changeset viewer.