summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/unlink.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/unlink.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/unlink.c')
-rw-r--r--cpukit/libcsupport/src/unlink.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cpukit/libcsupport/src/unlink.c b/cpukit/libcsupport/src/unlink.c
index 9817ad9611..2a3b1c75a8 100644
--- a/cpukit/libcsupport/src/unlink.c
+++ b/cpukit/libcsupport/src/unlink.c
@@ -34,9 +34,15 @@ int unlink( const char *path )
&parentloc,
parent_eval_flags
);
- const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
- rv = (*ops->rmnod_h)( &parentloc, currentloc );
+ if ( !rtems_filesystem_location_is_root( currentloc ) ) {
+ const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
+
+ rv = (*ops->rmnod_h)( &parentloc, currentloc );
+ } else {
+ rtems_filesystem_eval_path_error( &ctx, EBUSY );
+ rv = -1;
+ }
rtems_filesystem_eval_path_cleanup_with_parent( &ctx, &parentloc );