summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2003-08-05 15:50:11 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2003-08-05 15:50:11 +0000
commit1d4e666008b70c4e507eff0203696ff154d26961 (patch)
treefe76d2a7f52aa59c125af29fccdcf0181e0dcd7f /cpukit
parent2003-08-05 Thomas Doerfler <Thomas.Doerfler@imd-systems.de> (diff)
downloadrtems-1d4e666008b70c4e507eff0203696ff154d26961.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')
-rw-r--r--cpukit/libcsupport/ChangeLog5
-rw-r--r--cpukit/libcsupport/src/open.c6
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;
+ }
}
/*