summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/rmdir.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-10-02 15:44:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-10-07 17:03:20 +0200
commitc17d0b315baf3f3a3afb862f64d0acf424088442 (patch)
tree4b659a3d629d590525cadec5a32e57fd1ec8ad78 /cpukit/libcsupport/src/rmdir.c
parentscore: Critical fix for thread dispatching (diff)
downloadrtems-c17d0b315baf3f3a3afb862f64d0acf424088442.tar.bz2
Filesystem: Reject removal of root nodes
Reject the removal of file system instance root nodes in rmdir() and unlink() and return the EBUSY error status. File system instances can be removed with unmount(). Remove root node special cases in IMFS, DOSFS, and RFS.
Diffstat (limited to 'cpukit/libcsupport/src/rmdir.c')
-rw-r--r--cpukit/libcsupport/src/rmdir.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/rmdir.c b/cpukit/libcsupport/src/rmdir.c
index 4e7baf5e39..f2bc16e516 100644
--- a/cpukit/libcsupport/src/rmdir.c
+++ b/cpukit/libcsupport/src/rmdir.c
@@ -38,7 +38,12 @@ int rmdir( const char *path )
rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
- rv = (*ops->rmnod_h)( &parentloc, currentloc );
+ if ( !rtems_filesystem_location_is_root( currentloc ) ) {
+ rv = (*ops->rmnod_h)( &parentloc, currentloc );
+ } else {
+ rtems_filesystem_eval_path_error( &ctx, EBUSY );
+ rv = -1;
+ }
} else {
rtems_filesystem_eval_path_error( &ctx, ENOTDIR );
rv = -1;