From c17d0b315baf3f3a3afb862f64d0acf424088442 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 2 Oct 2012 15:44:59 +0200 Subject: 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. --- cpukit/libcsupport/src/rmdir.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cpukit/libcsupport/src/rmdir.c') 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; -- cgit v1.2.3