File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3012,15 +3012,19 @@ static int
30123012xpath_count (struct lyxp_set * * args , uint16_t UNUSED (arg_count ), struct lyd_node * UNUSED (cur_node ),
30133013 struct lys_module * UNUSED (local_mod ), struct lyxp_set * set , int options )
30143014{
3015- struct lys_node * snode ;
3015+ struct lys_node * snode , * sparent ;
30163016 int ret = EXIT_SUCCESS ;
30173017
30183018 if (options & LYXP_SNODE_ALL ) {
30193019 if ((args [0 ]-> type != LYXP_SET_SNODE_SET ) || !(snode = warn_get_snode_in_ctx (args [0 ]))) {
30203020 LOGWRN ("Argument #1 of %s not a node-set as expected." , __func__ );
30213021 ret = EXIT_FAILURE ;
3022- } else if (!(snode -> nodetype & (LYS_LIST | LYS_LEAFLIST ))) {
3023- LOGWRN ("Argument #1 of %s is a %s node \"%s\"." , __func__ , strnodetype (snode -> nodetype ), snode -> name );
3022+ }
3023+
3024+ for (sparent = snode ; sparent && !(sparent -> nodetype & (LYS_LIST | LYS_LEAFLIST )); sparent = lys_parent (sparent ));
3025+ if (!sparent ) {
3026+ LOGWRN ("Argument #1 of %s is a %s node \"%s\" without a list node parent." ,
3027+ __func__ , strnodetype (snode -> nodetype ), snode -> name );
30243028 ret = EXIT_FAILURE ;
30253029 }
30263030 set_snode_clear_ctx (set );
You can’t perform that action at this time.
0 commit comments