diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-10-12 18:44:40 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-10-12 18:44:40 +0000 |
commit | d71fcabaa6bc42e82d83060da49abff2b41ee272 (patch) | |
tree | 0fe667b13aa15cbab7baaed510a894fa1cb9dd78 /cpukit/libcsupport/src/link.c | |
parent | Changed bcopy to strncpy to stick to ANSI/ISO routines. (diff) | |
download | rtems-d71fcabaa6bc42e82d83060da49abff2b41ee272.tar.bz2 |
Added call to freenod to let each filesystem free its own internal
node used to manage file access.
Diffstat (limited to '')
-rw-r--r-- | cpukit/libcsupport/src/link.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/cpukit/libcsupport/src/link.c b/cpukit/libcsupport/src/link.c index c6a9f606e0..38ce78d87a 100644 --- a/cpukit/libcsupport/src/link.c +++ b/cpukit/libcsupport/src/link.c @@ -32,6 +32,7 @@ int link( /* * Get the node we are linking to. */ + result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE ); if ( result != 0 ) return -1; @@ -42,21 +43,47 @@ int link( rtems_filesystem_get_start_loc( new, &i, &parent_loc ); result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start ); - if ( result != 0 ) - set_errno_and_return_minus_one( result ); + if ( result != 0 ) { + if ( existing_loc.ops->freenod ) + (*existing_loc.ops->freenod)( &parent_loc ); + set_errno_and_return_minus_one( result ); + } /* * Check to see if the caller is trying to link across file system * boundaries. */ - if ( parent_loc.mt_entry != existing_loc.mt_entry ) + if ( parent_loc.mt_entry != existing_loc.mt_entry ) { + if ( existing_loc.ops->freenod ) + (*existing_loc.ops->freenod)( &existing_loc ); + + if ( parent_loc.ops->freenod ) + (*parent_loc.ops->freenod)( &parent_loc ); + set_errno_and_return_minus_one( EXDEV ); + } + + if ( !parent_loc.ops->link ) { + + if ( existing_loc.ops->freenod ) + (*existing_loc.ops->freenod)( &existing_loc ); + + if ( parent_loc.ops->freenod ) + (*parent_loc.ops->freenod)( &parent_loc ); - if ( !parent_loc.ops->link ) set_errno_and_return_minus_one( ENOTSUP ); + } + + result = (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start ); + + if ( existing_loc.ops->freenod ) + (*existing_loc.ops->freenod)( &existing_loc ); + + if ( parent_loc.ops->freenod ) + (*parent_loc.ops->freenod)( &parent_loc ); - return (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start ); + return result; } /* |