Changes in uspace/app/bdsh/cmds/modules/rm/rm.c [6afc9d7:d96d9bc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/rm/rm.c
r6afc9d7 rd96d9bc 30 30 #include <stdio.h> 31 31 #include <stdlib.h> 32 #include <unistd.h>33 #include <fcntl.h>34 32 #include <dirent.h> 35 33 #include <getopt.h> 36 34 #include <mem.h> 37 35 #include <str.h> 36 #include <vfs/vfs.h> 38 37 39 38 #include "config.h" … … 110 109 memset(rm->cwd, 0, PATH_MAX); 111 110 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)) 115 114 return 0; 116 115 … … 132 131 static unsigned int rm_single(const char *path) 133 132 { 134 if ( unlink(path) != 0) {133 if (vfs_unlink_path(path) != EOK) { 135 134 cli_error(CL_EFAIL, "rm: could not remove file %s", path); 136 135 return 1; … … 150 149 } 151 150 152 fd = open(path, O_RDONLY);151 fd = vfs_lookup(path, WALK_REGULAR); 153 152 if (fd >= 0) { 154 close(fd);153 vfs_put(fd); 155 154 return RM_FILE; 156 155 } … … 201 200 202 201 /* 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) 205 204 return 0; 206 205 … … 209 208 210 209 /* 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; 214 213 215 214 cli_error(CL_ENOTSUP, "Can not remove %s", path);
Note:
See TracChangeset
for help on using the changeset viewer.