Author: stefan2
Date: Fri Feb 6 10:30:21 2015
New Revision: 1657775
URL: http://svn.apache.org/r1657775
Log:
Push a pre-condition check deeper down the call stack to apply it
more universally.
* subversion/libsvn_fs_x/dag.c
(dir_entry_id_from_node): Check condition on directory entry name
immediately before using it.
(svn_fs_x__dag_open): Remove same check from caller.
Modified:
subversion/trunk/subversion/libsvn_fs_x/dag.c
Modified: subversion/trunk/subversion/libsvn_fs_x/dag.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1657775&r1=1657774&r2=1657775&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Fri Feb 6 10:30:21 2015
@@ -376,6 +376,12 @@ dir_entry_id_from_node(svn_fs_x__id_t *i
return svn_error_create(SVN_ERR_FS_NOT_DIRECTORY, NULL,
_("Can't get entries of non-directory"));
+ /* Make sure that NAME is a single path component. */
+ if (! svn_path_is_single_path_component(name))
+ return svn_error_createf
+ (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
+ "Attempted to open node with an illegal name '%s'", name);
+
/* Get a dirent hash for this directory. */
SVN_ERR(svn_fs_x__rep_contents_dir_entry(&dirent, parent->fs, noderev,
name, &parent->hint,
@@ -1193,12 +1199,6 @@ svn_fs_x__dag_open(dag_node_t **child_p,
return SVN_NO_ERROR;
}
- /* Make sure that NAME is a single path component. */
- if (! svn_path_is_single_path_component(name))
- return svn_error_createf
- (SVN_ERR_FS_NOT_SINGLE_PATH_COMPONENT, NULL,
- "Attempted to open node with an illegal name '%s'", name);
-
/* Now get the node that was requested. */
return svn_fs_x__dag_get_node(child_p, svn_fs_x__dag_get_fs(parent),
&node_id, result_pool, scratch_pool);