summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/fdatasync.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/fdatasync.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/fdatasync.c')
-rw-r--r--cpukit/libcsupport/src/fdatasync.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/fdatasync.c b/cpukit/libcsupport/src/fdatasync.c
index 14e66726e6..bf90957f0f 100644
--- a/cpukit/libcsupport/src/fdatasync.c
+++ b/cpukit/libcsupport/src/fdatasync.c
@@ -28,6 +28,7 @@ int fdatasync(
)
{
rtems_libio_t *iop;
+ int rv;
LIBIO_GET_IOP_WITH_ACCESS( fd, iop, LIBIO_FLAGS_WRITE, EBADF );
@@ -35,5 +36,7 @@ int fdatasync(
* Now process the fdatasync().
*/
- return (*iop->pathinfo.handlers->fdatasync_h)( iop );
+ rv = (*iop->pathinfo.handlers->fdatasync_h)( iop );
+ rtems_libio_iop_drop( iop );
+ return rv;
}