summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2002-10-24 18:54:07 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2002-10-24 18:54:07 +0000
commit1d6662951eb7ba8e7de3e107467cfea594e2c6ac (patch)
tree1d0b59f5c1c5950109a928c731d586e042d8cefb /cpukit
parent2002-10-23 <strauman@slac.stanford.edu> (diff)
downloadrtems-1d6662951eb7ba8e7de3e107467cfea594e2c6ac.tar.bz2
2002-10-24 <strauman@slac.stanford.edu>
* src/eval.c: Per PR293, added freenode calls for evaluate link failures.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libcsupport/src/eval.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/cpukit/libcsupport/src/eval.c b/cpukit/libcsupport/src/eval.c
index 7d70d20cf7..971c2a72af 100644
--- a/cpukit/libcsupport/src/eval.c
+++ b/cpukit/libcsupport/src/eval.c
@@ -60,18 +60,36 @@ int rtems_filesystem_evaluate_path(
if ( (result == 0) && follow_link ) {
- if ( !pathloc->ops->node_type_h )
+ if ( !pathloc->ops->node_type_h ){
+ rtems_filesystem_freenode( pathloc );
rtems_set_errno_and_return_minus_one( ENOTSUP );
+ }
type = (*pathloc->ops->node_type_h)( pathloc );
if ( ( type == RTEMS_FILESYSTEM_HARD_LINK ) ||
( type == RTEMS_FILESYSTEM_SYM_LINK ) ) {
- if ( !pathloc->ops->eval_link_h )
+ if ( !pathloc->ops->eval_link_h ){
+ rtems_filesystem_freenode( pathloc );
rtems_set_errno_and_return_minus_one( ENOTSUP );
-
- result = (*pathloc->ops->eval_link_h)( pathloc, flags );
+ }
+
+ /* what to do with the valid node pathloc points to
+ * if eval_link_h fails?
+ * Let the FS implementation deal with this case. It
+ * should probably free pathloc in either case:
+ * - if the link evaluation fails, it must free the
+ * original (valid) pathloc because we are going
+ * to return -1 and hence the FS generics won't
+ * cleanup pathloc.
+ * - if the link evaluation is successful, the updated
+ * pathloc will be passed up (and eventually released).
+ * Hence, the (valid) originial node that we submit to
+ * eval_link_h() should be released by the handler.
+ */
+
+ result = (*pathloc->ops->eval_link_h)( pathloc, flags );
}
}