summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-10-02 17:42:39 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-10-02 17:42:39 +0000
commit2b30225a644b02d33e99dfc1669196a0e9658e62 (patch)
treed414580549d74fca8efec0cfc08ea3bed6161a93 /cpukit
parent2002-10-02 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-2b30225a644b02d33e99dfc1669196a0e9658e62.tar.bz2
2002-10-02 Jennifer Averett <jennifer@OARcorp.com>
* src/imfs/memfile.c: Fixed case where last close of unlinked file did not remove the resources associated with that file. Reported by Till Straumann <strauman@slac.stanford.edu> on the mailing list.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libfs/ChangeLog6
-rw-r--r--cpukit/libfs/src/imfs/memfile.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/cpukit/libfs/ChangeLog b/cpukit/libfs/ChangeLog
index 3489bf9cd5..0a073d3b8e 100644
--- a/cpukit/libfs/ChangeLog
+++ b/cpukit/libfs/ChangeLog
@@ -1,3 +1,9 @@
+2002-10-02 Jennifer Averett <jennifer@OARcorp.com>
+
+ * src/imfs/memfile.c: Fixed case where last close of unlinked file
+ did not remove the resources associated with that file. Reported
+ by Till Straumann <strauman@slac.stanford.edu> on the mailing list.
+
2002-09-14 Joel Sherrill <joel@OARcorp.com>
* src/dosfs/fat.c, src/imfs/deviceio.c, src/imfs/imfs.h,
diff --git a/cpukit/libfs/src/imfs/memfile.c b/cpukit/libfs/src/imfs/memfile.c
index 711e0c0383..bb6fdcac34 100644
--- a/cpukit/libfs/src/imfs/memfile.c
+++ b/cpukit/libfs/src/imfs/memfile.c
@@ -73,6 +73,8 @@ ssize_t IMFS_memfile_write( /* cannot be static as used in imfs_fchmod.c */
unsigned int length
);
+int memfile_check_rmnod( IMFS_jnode_t *the_jnode );
+
void *memfile_alloc_block(void);
void memfile_free_block(
@@ -122,6 +124,7 @@ int memfile_close(
if (iop->flags & LIBIO_FLAGS_APPEND)
iop->offset = the_jnode->info.file.size;
+ memfile_check_rmnod( the_jnode );
return 0;
}
@@ -1108,6 +1111,12 @@ int memfile_rmnod(
the_jnode->st_nlink--;
IMFS_update_ctime( the_jnode );
+ return memfile_check_rmnod( the_jnode );
+}
+
+
+int memfile_check_rmnod( IMFS_jnode_t *the_jnode ){
+
/*
* The file cannot be open and the link must be less than 1 to free.
*/
@@ -1118,7 +1127,7 @@ int memfile_rmnod(
* Is the rtems_filesystem_current is this node?
*/
- if ( rtems_filesystem_current.node_access == pathloc->node_access )
+ if ( rtems_filesystem_current.node_access == the_jnode )
rtems_filesystem_current.node_access = NULL;
/*
@@ -1131,7 +1140,6 @@ int memfile_rmnod(
}
return 0;
-
}