summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2003-08-05 15:54:28 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2003-08-05 15:54:28 +0000
commitf114f9d03cc13a614c4691c6269780ec4b912656 (patch)
tree302f462e071eceeb3ff28ed5d216db092d91a63c /cpukit/libcsupport/src
parent2003-08-05 Thomas Doerfler <Thomas.Doerfler@imd-systems.de> (diff)
downloadrtems-f114f9d03cc13a614c4691c6269780ec4b912656.tar.bz2
2003-08-05 Till Strauman <strauman@slac.stanford.edu>
PR 442/filesystem * src/open.c: file never closed if ftruncate() fails in open()
Diffstat (limited to 'cpukit/libcsupport/src')
-rw-r--r--cpukit/libcsupport/src/open.c6
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;
+ }
}
/*