diff --git a/src/cryptsetup.c b/src/cryptsetup.c index 259dc645..f35915f4 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -125,6 +125,10 @@ static const char **action_argv; static int action_argc; static const char *null_action_argv[] = {NULL, NULL}; +void tools_cleanup(void) +{ +} + static const char *uuid_or_device_header(const char **data_device) { if (data_device) diff --git a/src/cryptsetup.h b/src/cryptsetup.h index 1afcf433..a312651a 100644 --- a/src/cryptsetup.h +++ b/src/cryptsetup.h @@ -116,6 +116,9 @@ int tools_wipe_all_signatures(const char *path); int tools_lookup_crypt_device(struct crypt_device *cd, const char *type, const char *data_device_path, char *name, size_t name_length); +/* each utility is required to implement it */ +void tools_cleanup(void); + /* Log */ #define log_dbg(x...) clogger(NULL, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x) #define log_std(x...) clogger(NULL, CRYPT_LOG_NORMAL, __FILE__, __LINE__, x) diff --git a/src/cryptsetup_reencrypt.c b/src/cryptsetup_reencrypt.c index 3c3bf04b..27b0031f 100644 --- a/src/cryptsetup_reencrypt.c +++ b/src/cryptsetup_reencrypt.c @@ -117,6 +117,10 @@ typedef enum { CHECK_OPEN, } header_magic; +void tools_cleanup(void) +{ +} + static void _quiet_log(int level, const char *msg, void *usrptr) { if (!opt_debug) diff --git a/src/integritysetup.c b/src/integritysetup.c index 84e70ed1..ed32259e 100644 --- a/src/integritysetup.c +++ b/src/integritysetup.c @@ -63,6 +63,10 @@ static const char *integrity_alg = DEFAULT_ALG_NAME; static const char **action_argv; static int action_argc; +void tools_cleanup(void) +{ +} + // FIXME: move this to tools and handle EINTR static int _read_mk(const char *file, char **key, int keysize) { diff --git a/src/utils_tools.c b/src/utils_tools.c index 47bcfe12..3558cd74 100644 --- a/src/utils_tools.c +++ b/src/utils_tools.c @@ -238,6 +238,7 @@ __attribute__ ((noreturn)) void usage(poptContext popt_context, poptPrintUsage(popt_context, stderr, 0); if (error) log_err("%s: %s", more, error); + tools_cleanup(); poptFreeContext(popt_context); exit(exitcode); } diff --git a/src/veritysetup.c b/src/veritysetup.c index 80cfa3df..4461b922 100644 --- a/src/veritysetup.c +++ b/src/veritysetup.c @@ -45,6 +45,10 @@ static int opt_check_at_most_once = 0; static const char **action_argv; static int action_argc; +void tools_cleanup(void) +{ +} + static int _prepare_format(struct crypt_params_verity *params, const char *data_device, uint32_t flags)