summaryrefslogtreecommitdiffstats
path: root/c/src/exec/libcsupport/src/fchmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/exec/libcsupport/src/fchmod.c')
-rw-r--r--c/src/exec/libcsupport/src/fchmod.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/c/src/exec/libcsupport/src/fchmod.c b/c/src/exec/libcsupport/src/fchmod.c
index a3ca4507ab..f202a30eb0 100644
--- a/c/src/exec/libcsupport/src/fchmod.c
+++ b/c/src/exec/libcsupport/src/fchmod.c
@@ -27,19 +27,20 @@ int fchmod(
{
rtems_libio_t *iop;
+ rtems_libio_check_fd( fd );
+ iop = rtems_libio_iop( fd );
+
/*
* If this is not a file system based entity, it is an error.
*/
- if ( rtems_file_descriptor_type( fd ) )
+ if ( iop->flags & LIBIO_FLAGS_HANDLER_MASK )
set_errno_and_return_minus_one( EBADF );
/*
* Now process the fchmod().
*/
- iop = rtems_libio_iop( fd );
- rtems_libio_check_fd( fd );
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
if ( !iop->handlers->fchmod )