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 /c/src/lib/libc/open.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 'c/src/lib/libc/open.c')
-rw-r--r-- | c/src/lib/libc/open.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/c/src/lib/libc/open.c b/c/src/lib/libc/open.c index 7efa18e829..1bd6ea5ec6 100644 --- a/c/src/lib/libc/open.c +++ b/c/src/lib/libc/open.c @@ -62,7 +62,7 @@ int open( int rc; rtems_libio_t *iop = 0; int status; - rtems_filesystem_location_info_t temp_loc; + rtems_filesystem_location_info_t loc; int eval_flags; @@ -104,7 +104,7 @@ int open( */ status = rtems_filesystem_evaluate_path( - pathname, eval_flags, &temp_loc, TRUE ); + pathname, eval_flags, &loc, TRUE ); if ( status == -1 ) { if ( errno != ENOENT ) { @@ -126,7 +126,7 @@ int open( } /* Sanity check to see if the file name exists after the mknod() */ - status = rtems_filesystem_evaluate_path( pathname, 0x0, &temp_loc, TRUE ); + status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, TRUE ); if ( status != 0 ) { /* The file did not exist */ rc = EACCES; goto done; @@ -139,15 +139,15 @@ int open( } /* - * Fill in the file control block based on the temp_loc structure + * Fill in the file control block based on the loc structure * returned by successful path evaluation. */ iop->offset = 0; - iop->handlers = temp_loc.handlers; - iop->file_info = temp_loc.node_access; + iop->handlers = loc.handlers; + iop->file_info = loc.node_access; iop->flags |= rtems_libio_fcntl_flags( flags ); - iop->pathinfo = temp_loc; + iop->pathinfo = loc; if ( !iop->handlers->open ) { rc = ENOTSUP; @@ -178,6 +178,10 @@ done: rtems_libio_free( iop ); set_errno_and_return_minus_one( rc ); } + + if ( loc.ops->freenod ) + (*loc.ops->freenod)( &loc ); + return iop - rtems_libio_iops; } |