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/write.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cpukit/libcsupport/src/write.c') diff --git a/cpukit/libcsupport/src/write.c b/cpukit/libcsupport/src/write.c index f44962afd8..a90b291ed8 100644 --- a/cpukit/libcsupport/src/write.c +++ b/cpukit/libcsupport/src/write.c @@ -34,6 +34,7 @@ ssize_t write( ) { rtems_libio_t *iop; + ssize_t n; rtems_libio_check_buffer( buffer ); rtems_libio_check_count( count ); @@ -43,5 +44,7 @@ ssize_t write( /* * Now process the write() request. */ - return (*iop->pathinfo.handlers->write_h)( iop, buffer, count ); + n = (*iop->pathinfo.handlers->write_h)( iop, buffer, count ); + rtems_libio_iop_drop( iop ); + return n; } -- cgit v1.2.3