summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/include/rtems/libio_.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-07-22 16:04:38 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-07-22 16:04:38 +0000
commit58f3fab9598c531ea1ea4e13702abb8d87b75bf2 (patch)
tree666c7861336b142ec3bac6812ccbba9b574bdc94 /cpukit/libcsupport/include/rtems/libio_.h
parent2011-07-21 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-58f3fab9598c531ea1ea4e13702abb8d87b75bf2.tar.bz2
2011-07-22 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1839/filesystem * libcsupport/include/rtems/libio_.h, libcsupport/src/fchdir.c, libcsupport/src/fdatasync.c, libcsupport/src/fpathconf.c, libcsupport/src/fsync.c, libcsupport/src/ftruncate.c, libcsupport/src/read.c, libcsupport/src/readv.c, libcsupport/src/write.c, libcsupport/src/writev.c: Some calls did not return proper status for permission errors or incorrectly permissions at all.
Diffstat (limited to 'cpukit/libcsupport/include/rtems/libio_.h')
-rw-r--r--cpukit/libcsupport/include/rtems/libio_.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h
index e9a7dd3cb8..e0396daa24 100644
--- a/cpukit/libcsupport/include/rtems/libio_.h
+++ b/cpukit/libcsupport/include/rtems/libio_.h
@@ -123,20 +123,31 @@ extern rtems_libio_t *rtems_libio_iop_freelist;
} while (0)
/*
- * rtems_libio_check_permissions
+ * rtems_libio_check_permissions_with_error
*
* Macro to check if a file descriptor is open for this operation.
+ * On failure, return the user specified error.
*/
-#define rtems_libio_check_permissions(_iop, _flag) \
+#define rtems_libio_check_permissions_with_error(_iop, _flag, _errno) \
do { \
if (((_iop)->flags & (_flag)) == 0) { \
- rtems_set_errno_and_return_minus_one( EINVAL ); \
+ rtems_set_errno_and_return_minus_one( _errno ); \
return -1; \
} \
} while (0)
/*
+ * rtems_libio_check_permissions
+ *
+ * Macro to check if a file descriptor is open for this operation.
+ * On failure, return EINVAL
+ */
+
+#define rtems_libio_check_permissions(_iop, _flag) \
+ rtems_libio_check_permissions_with_error(_iop, _flag, EINVAL )
+
+/*
* rtems_filesystem_freenode
*
* Macro to free a node.