From a937a5a5347cf945fe7eff17eccd97cc849a5349 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Sep 2017 10:35:45 +0200 Subject: libio: Add rtems_libio_iop_is_readable() Update #3132. --- cpukit/libcsupport/include/rtems/libio.h | 10 ++++++++++ cpukit/libnetworking/lib/ftpfs.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'cpukit') diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index 702ec352b9..7d85fb7af3 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -1389,6 +1389,16 @@ static inline bool rtems_libio_iop_is_no_delay( const rtems_libio_t *iop ) return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_NO_DELAY ) != 0; } +/** + * @brief Returns true if this is a readable iop, otherwise returns false. + * + * @param[in] iop The iop. + */ +static inline bool rtems_libio_iop_is_readable( const rtems_libio_t *iop ) +{ + return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_READ ) != 0; +} + /** * @name External I/O Handlers */ diff --git a/cpukit/libnetworking/lib/ftpfs.c b/cpukit/libnetworking/lib/ftpfs.c index 912ec82b39..deccddfa89 100644 --- a/cpukit/libnetworking/lib/ftpfs.c +++ b/cpukit/libnetworking/lib/ftpfs.c @@ -1037,7 +1037,7 @@ static int rtems_ftpfs_open( /* Check for either read-only or write-only flags */ if ( (iop->flags & LIBIO_FLAGS_WRITE) != 0 - && (iop->flags & LIBIO_FLAGS_READ) != 0 + && rtems_libio_iop_is_readable(iop) ) { eno = ENOTSUP; } -- cgit v1.2.3