summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/open.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-13 09:22:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-15 10:29:34 +0200
commitbaef823cd550449bfbcc36625b9571389d8ad1af (patch)
tree238c1952d23dc09d41ae99d186d0656f78ed857b /cpukit/libcsupport/src/open.c
parentlibio: Unify readv() and writev() (diff)
downloadrtems-baef823cd550449bfbcc36625b9571389d8ad1af.tar.bz2
libio: Add hold/drop iop reference
Check iop reference count in close() and return -1 with errno set to EBUSY in case the file descriptor is still in use. Update #3132.
Diffstat (limited to 'cpukit/libcsupport/src/open.c')
-rw-r--r--cpukit/libcsupport/src/open.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/open.c b/cpukit/libcsupport/src/open.c
index 22773454ba..8558e207d3 100644
--- a/cpukit/libcsupport/src/open.c
+++ b/cpukit/libcsupport/src/open.c
@@ -99,7 +99,11 @@ static int do_open(
rtems_filesystem_eval_path_extract_currentloc( &ctx, &iop->pathinfo );
rtems_filesystem_eval_path_cleanup( &ctx );
- iop->flags = rtems_libio_fcntl_flags( oflag );
+ _Atomic_Store_uint(
+ &iop->flags,
+ rtems_libio_fcntl_flags( oflag ),
+ ATOMIC_ORDER_RELAXED
+ );
rv = (*iop->pathinfo.handlers->open_h)( iop, path, oflag, mode );