summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/fcntl.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-13 14:00:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-15 10:27:08 +0200
commitca90c6c1db3881ce5a44e06610a29a128e5455f2 (patch)
treef54ed2c4c10d7d73be307647553ca2f7971f6573 /cpukit/libcsupport/src/fcntl.c
parentlibio: Add iop set/clear flags (diff)
downloadrtems-ca90c6c1db3881ce5a44e06610a29a128e5455f2.tar.bz2
libio: Add rtems_libio_iop_flags_initialize()
Update #3132.
Diffstat (limited to 'cpukit/libcsupport/src/fcntl.c')
-rw-r--r--cpukit/libcsupport/src/fcntl.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/cpukit/libcsupport/src/fcntl.c b/cpukit/libcsupport/src/fcntl.c
index 0fe734d61c..82052011ec 100644
--- a/cpukit/libcsupport/src/fcntl.c
+++ b/cpukit/libcsupport/src/fcntl.c
@@ -26,15 +26,14 @@
static int duplicate_iop( rtems_libio_t *iop )
{
- int rv = 0;
+ int rv;
+ int oflag;
+ rtems_libio_t *diop;
- rtems_libio_t *diop = rtems_libio_allocate();
+ oflag = rtems_libio_to_fcntl_flags( iop->flags );
+ diop = rtems_libio_allocate();
if (diop != NULL) {
- int oflag = rtems_libio_to_fcntl_flags( iop->flags );
-
- rtems_libio_iop_flags_set( diop, rtems_libio_fcntl_flags( oflag ) );
-
rtems_filesystem_instance_lock( &iop->pathinfo );
rtems_filesystem_location_clone( &diop->pathinfo, &iop->pathinfo );
rtems_filesystem_instance_unlock( &iop->pathinfo );
@@ -46,6 +45,10 @@ static int duplicate_iop( rtems_libio_t *iop )
*/
rv = (*diop->pathinfo.handlers->open_h)( diop, NULL, oflag, 0 );
if ( rv == 0 ) {
+ rtems_libio_iop_flags_initialize(
+ diop,
+ rtems_libio_fcntl_flags( oflag )
+ );
rv = rtems_libio_iop_to_descriptor( diop );
} else {
rtems_libio_free( diop );