diff options
Diffstat (limited to 'cpukit/libcsupport/include/rtems/libio_.h')
-rw-r--r-- | cpukit/libcsupport/include/rtems/libio_.h | 17 |
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. |