diff options
Diffstat (limited to '')
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_link.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_link.c b/cpukit/libfs/src/imfs/imfs_link.c index 27e04ffae2..06794af682 100644 --- a/cpukit/libfs/src/imfs/imfs_link.c +++ b/cpukit/libfs/src/imfs/imfs_link.c @@ -119,7 +119,7 @@ static IMFS_jnode_t *IMFS_node_remove_hard_link( _Assert( target != NULL ); - if ( target->st_nlink == 1) { + if ( target->st_nlink == 1 ) { target = (*target->control->node_remove)( target ); if ( target == NULL ) { node = NULL; @@ -129,6 +129,14 @@ static IMFS_jnode_t *IMFS_node_remove_hard_link( IMFS_update_ctime( target ); } + if ( target != NULL ) { + --target->reference_count; + + if ( target->reference_count == 0 ) { + IMFS_node_destroy( target ); + } + } + return node; } |