summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-08-27 17:32:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-08-27 17:32:59 +0000
commit9063a0e3c9136c11ab64aa59680224ef04a11c97 (patch)
treeec51a644de09b98d3e1eca82694c781b53439905
parent225216358a11906e418f0ef680136056f05c9b3b (diff)
2010-08-27 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1692/filesystem * libcsupport/include/rtems/libio.h, libfs/src/devfs/devfs_eval.c, libfs/src/imfs/imfs_eval.c: Fix implementation and use of rtems_libio_is_valid_perms().
-rw-r--r--cpukit/ChangeLog7
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h2
-rw-r--r--cpukit/libfs/src/devfs/devfs_eval.c6
-rw-r--r--cpukit/libfs/src/imfs/imfs_eval.c5
4 files changed, 12 insertions, 8 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 9603f33cfe..aab53ec721 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-27 Joel Sherrill <joel.sherrilL@OARcorp.com>
+
+ PR 1692/filesystem
+ * libcsupport/include/rtems/libio.h, libfs/src/devfs/devfs_eval.c,
+ libfs/src/imfs/imfs_eval.c: Fix implementation and use of
+ rtems_libio_is_valid_perms().
+
2010-08-26 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libfs/src/defaults/default_evalpath.c,
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index 1068074682..73c52e31d7 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -1287,7 +1287,7 @@ static inline rtems_device_minor_number rtems_filesystem_dev_minor_t(
* Verifies that the permission flag is valid.
*/
#define rtems_libio_is_valid_perms( _perm ) \
- (~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm ))
+ (((~RTEMS_LIBIO_PERMS_RWX) & _perm ) == 0)
/*
* Prototypes for filesystem
diff --git a/cpukit/libfs/src/devfs/devfs_eval.c b/cpukit/libfs/src/devfs/devfs_eval.c
index 0df5754ad5..a3169fb3fa 100644
--- a/cpukit/libfs/src/devfs/devfs_eval.c
+++ b/cpukit/libfs/src/devfs/devfs_eval.c
@@ -40,10 +40,8 @@ int devFS_evaluate_path(
rtems_device_name_t *device_name_table;
/* see if 'flags' is valid */
- if ( !rtems_libio_is_valid_perms( flags ) ) {
- assert( 0 );
- rtems_set_errno_and_return_minus_one( EIO );
- }
+ if ( !rtems_libio_is_valid_perms( flags ) )
+ rtems_set_errno_and_return_minus_one( EPERM );
/* get the device name table */
device_name_table = (rtems_device_name_t *)pathloc->node_access;
diff --git a/cpukit/libfs/src/imfs/imfs_eval.c b/cpukit/libfs/src/imfs/imfs_eval.c
index 22cc983f7f..503c65179a 100644
--- a/cpukit/libfs/src/imfs/imfs_eval.c
+++ b/cpukit/libfs/src/imfs/imfs_eval.c
@@ -80,9 +80,8 @@ int IMFS_evaluate_permission(
IMFS_jnode_t *jnode;
int flags_to_test;
- if ( !rtems_libio_is_valid_perms( flags ) ) {
- rtems_set_errno_and_return_minus_one( EIO );
- }
+ if ( !rtems_libio_is_valid_perms( flags ) )
+ rtems_set_errno_and_return_minus_one( EPERM );
jnode = node->node_access;