From 9012db84f611d5c394683ddcca95354928a8b505 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Sep 2017 11:33:25 +0200 Subject: libio: LIBIO_GET_IOP() LIBIO_GET_IOP_WITH_ACCESS() Replace rtems_libio_check_fd(), rtems_libio_iop(), rtems_libio_check_open() and rtems_libio_check_permissions() combinations with new LIBIO_GET_IOP() and LIBIO_GET_IOP_WITH_ACCESS() macros. Update #3132. --- cpukit/libcsupport/src/fcntl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cpukit/libcsupport/src/fcntl.c') diff --git a/cpukit/libcsupport/src/fcntl.c b/cpukit/libcsupport/src/fcntl.c index d44d4a0c1e..a7fcfbc041 100644 --- a/cpukit/libcsupport/src/fcntl.c +++ b/cpukit/libcsupport/src/fcntl.c @@ -65,7 +65,10 @@ static int duplicate2_iop( rtems_libio_t *iop, int fd2 ) rtems_libio_t *iop2; int rv = 0; - rtems_libio_check_fd( fd2 ); + if ( (uint32_t) fd2 >= rtems_libio_number_iops ) { + rtems_set_errno_and_return_minus_one( EBADF ); + } + iop2 = rtems_libio_iop( fd2 ); if (iop != iop2) @@ -112,9 +115,7 @@ static int vfcntl( int mask; int ret = 0; - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); + LIBIO_GET_IOP( fd, iop ); /* * Now process the fcntl(). -- cgit v1.2.3