diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-10-02 17:42:39 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-10-02 17:42:39 +0000 |
commit | 2b30225a644b02d33e99dfc1669196a0e9658e62 (patch) | |
tree | d414580549d74fca8efec0cfc08ea3bed6161a93 /cpukit/libfs/src | |
parent | 2002-10-02 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-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 '')
-rw-r--r-- | cpukit/libfs/src/imfs/memfile.c | 12 |
1 files changed, 10 insertions, 2 deletions
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; - } |