The Sleuth Kit 4.15.0-develop
tsk_error.c File Reference

Contains the error handling code and variables. More...

#include "tsk_base_i.h"
#include "tsk_base.h"

Functions

void tsk_error_errstr2_concat (const char *format,...)
 Concatenate a message onto the end of the errstr2.
const char * tsk_error_get ()
 Return the string with the current error message.
uint32_t tsk_error_get_errno ()
 Return the current error number.
char * tsk_error_get_errstr ()
 Retrieve the current, basic error string.
char * tsk_error_get_errstr2 ()
 Retrieve the current error string #2.
TSK_ERROR_INFOtsk_error_get_info ()
void tsk_error_print (FILE *hFile)
 Print the current fully formed error message to a file.
void tsk_error_reset ()
 Clear the error number and error message.
void tsk_error_set_errno (uint32_t t_errno)
 Set the current TSK error number.
void tsk_error_set_error_listener (TSK_ERROR_LISTENER_CB listener)
 Add a method that will be sent most errors (in additional to the processing TSK already does).
void tsk_error_set_errstr (const char *format,...)
 Set the error string #1.
void tsk_error_set_errstr2 (const char *format,...)
 Set the error string #2.
void tsk_error_vset_errstr (const char *format, va_list args)
 Set the error string.
void tsk_error_vset_errstr2 (const char *format, va_list args)
 Set the error string.

Variables

TSK_ERROR_LISTENER_CB error_listener = NULL
char * progname = "unknown"
int tsk_verbose = 0
 Set to 1 to have verbose debug messages printed to stderr.

Detailed Description

Contains the error handling code and variables.

Function Documentation

◆ tsk_error_set_error_listener()

void tsk_error_set_error_listener ( TSK_ERROR_LISTENER_CB listener)

Add a method that will be sent most errors (in additional to the processing TSK already does).

This is a bit limited since adding an error is a multistep process. The listener is invoked when tsk_error_set_errstr() is called. Our convention is that tsk_error_set_errno() is called first so the errno should be accurate. We would miss anything set to errstr2 but this is not very common.

Parameters
listenerMethod that should take arguments (uint32_t, const char*)

Copyright © 2007-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.