From baef823cd550449bfbcc36625b9571389d8ad1af Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Sep 2017 09:22:19 +0200 Subject: 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. --- cpukit/libcsupport/src/fsync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cpukit/libcsupport/src/fsync.c') diff --git a/cpukit/libcsupport/src/fsync.c b/cpukit/libcsupport/src/fsync.c index 6332180721..428f82abd0 100644 --- a/cpukit/libcsupport/src/fsync.c +++ b/cpukit/libcsupport/src/fsync.c @@ -31,6 +31,7 @@ int fsync( ) { rtems_libio_t *iop; + int rv; LIBIO_GET_IOP( fd, iop ); @@ -38,5 +39,7 @@ int fsync( * Now process the fsync(). */ - return (*iop->pathinfo.handlers->fsync_h)( iop ); + rv = (*iop->pathinfo.handlers->fsync_h)( iop ); + rtems_libio_iop_drop( iop ); + return rv; } -- cgit v1.2.3