diff options
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libcsupport/ChangeLog | 5 | ||||
-rw-r--r-- | cpukit/libcsupport/src/open.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/cpukit/libcsupport/ChangeLog b/cpukit/libcsupport/ChangeLog index 81a142a161..401f13b3dd 100644 --- a/cpukit/libcsupport/ChangeLog +++ b/cpukit/libcsupport/ChangeLog @@ -1,3 +1,8 @@ +2003-08-05 Till Strauman <strauman@slac.stanford.edu> + + PR 442/filesystem + * src/open.c: file never closed if ftruncate() fails in open() + 2003-07-08 Joel Sherrill <joel@OARcorp.com> PR 419/rtems 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; + } } /* |