Skip to content

Commit

Permalink
rust: add C callback for FatalErrorOnInit
Browse files Browse the repository at this point in the history
  • Loading branch information
inashivb committed Jan 9, 2025
1 parent 55efbb8 commit 053e309
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rust/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,9 @@ pub unsafe extern "C" fn rs_to_hex_sep(
// overwrites last separator with final null char
oslice[3 * islice.len() - 1] = 0;
}

// Defined in util-debug.c
/// cbindgen:ignore
extern {
pub fn CallbackFatalErrorOnInit(arg: *const c_char);
}
6 changes: 6 additions & 0 deletions src/util-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,12 @@ void SCLogDeInitLogModule(void)
#endif /* OS_WIN32 */
}


void CallbackFatalErrorOnInit(const char *arg)
{
FatalErrorOnInit("%s", arg);
}

//------------------------------------Unit_Tests--------------------------------

/* The logging engine should be tested to the maximum extent possible, since
Expand Down
2 changes: 2 additions & 0 deletions src/util-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ SCLogInitData *SCLogAllocLogInitData(void);

void SCLogAppendOPIfaceCtx(SCLogOPIfaceCtx *, SCLogInitData *);

void CallbackFatalErrorOnInit(const char *);

void SCLogInitLogModule(SCLogInitData *);

void SCLogDeInitLogModule(void);
Expand Down

0 comments on commit 053e309

Please sign in to comment.