Skip to content

Commit

Permalink
fix: restore debug output indentation in catch clause
Browse files Browse the repository at this point in the history
  • Loading branch information
gremat committed Jan 17, 2025
1 parent 5ff67fc commit 9988d9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libyara/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ static void exception_handler(int sig, siginfo_t * info, void *context)
}
}

extern YR_TLS int yr_debug_indent;

typedef struct sigaction sa;

#define YR_TRYCATCH(_do_, _try_clause_, _catch_clause_) \
Expand All @@ -243,6 +245,7 @@ typedef struct sigaction sa;
} \
exception_handler_usecount++; \
pthread_mutex_unlock(&exception_handler_mutex); \
int yr_debug_indent_before_jump = yr_debug_indent; \
jumpinfo ji; \
ji.memfault_from = 0; \
ji.memfault_to = 0; \
Expand All @@ -256,6 +259,9 @@ typedef struct sigaction sa;
} \
else \
{ \
/* Restore debug output indentation in case of failure */ \
yr_debug_indent = yr_debug_indent_before_jump; \
\
_catch_clause_ \
} \
pthread_mutex_lock(&exception_handler_mutex); \
Expand Down

0 comments on commit 9988d9b

Please sign in to comment.