diff options
Diffstat (limited to 'cpukit/libcsupport/src/open.c')
-rw-r--r-- | cpukit/libcsupport/src/open.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/open.c b/cpukit/libcsupport/src/open.c index f36f74d4ac..0f79d61a49 100644 --- a/cpukit/libcsupport/src/open.c +++ b/cpukit/libcsupport/src/open.c @@ -173,6 +173,12 @@ int open( if ( (flags & O_TRUNC) == O_TRUNC ) { rc = ftruncate( iop - rtems_libio_iops, 0 ); + if ( rc ) { + close( iop - rtems_libio_iops ); + /* those are released by close(): */ + iop = 0; + loc_to_free = NULL; + } } /* |