]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move save / restore indent to the correct spots
authorAlan T. DeKok <aland@freeradius.org>
Fri, 16 Sep 2022 15:31:54 +0000 (11:31 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 16 Sep 2022 15:31:54 +0000 (11:31 -0400)
src/lib/unlang/edit.c

index 177d9a2369c3b66c1a2f67988ac18494a5631f68..49fd4e3dc0f06a13f7ca5ad49836d72a8817172f 100644 (file)
@@ -1222,8 +1222,6 @@ static unlang_action_t process_edit(rlm_rcode_t *p_result, request_t *request, u
 {
        unlang_frame_state_edit_t       *state = talloc_get_type_abort(frame->state, unlang_frame_state_edit_t);
 
-       RINDENT_SAVE(&state->indent, request);
-
        /*
         *      Keep running the "expand map" function until done.
         */
@@ -1233,6 +1231,8 @@ static unlang_action_t process_edit(rlm_rcode_t *p_result, request_t *request, u
 
                        rcode = state->current->func(request, state, state->current);
                        if (rcode < 0) {
+                               RINDENT_RESTORE(request, &state->indent);
+
                                fr_edit_list_abort(state->el);
                                TALLOC_FREE(frame->state);
                                repeatable_clear(frame);
@@ -1243,7 +1243,6 @@ static unlang_action_t process_edit(rlm_rcode_t *p_result, request_t *request, u
                                 *      failures, which simply don't
                                 *      apply the operations.
                                 */
-                               RINDENT_RESTORE(request, &state->indent);
                                return UNLANG_ACTION_CALCULATE_RESULT;
                        }
 
@@ -1306,6 +1305,11 @@ static unlang_action_t unlang_edit_state_init(rlm_rcode_t *p_result, request_t *
        current->check_lhs = check_lhs;
        current->expanded_lhs = expanded_lhs_attribute;
 
+       /*
+        *      Save current indentation for the error path.
+        */
+       RINDENT_SAVE(&state->indent, request);
+
        /*
         *      Call process_edit to do all of the work.
         */