Plugin cleanup hook is not allowed to fail
- Having the cleanup hook return an error code is almost like free() returned an error code you're supposed to check and if it fails then ... what? :) Make it "return" void instead, fixup plugins.
This commit is contained in:
parent
08b7daccee
commit
f7db9ee129
|
@ -13,7 +13,7 @@
|
|||
#define STR(x) STR1(x)
|
||||
|
||||
static rpmRC rpmpluginsCallInit(rpmPlugin plugin, rpmts ts, const char *opts);
|
||||
static rpmRC rpmpluginsCallCleanup(rpmPlugin plugin);
|
||||
static void rpmpluginsCallCleanup(rpmPlugin plugin);
|
||||
|
||||
struct rpmPlugin_s {
|
||||
char *name;
|
||||
|
@ -189,14 +189,12 @@ static rpmRC rpmpluginsCallInit(rpmPlugin plugin, rpmts ts, const char *opts)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static rpmRC rpmpluginsCallCleanup(rpmPlugin plugin)
|
||||
static void rpmpluginsCallCleanup(rpmPlugin plugin)
|
||||
{
|
||||
rpmRC rc = RPMRC_OK;
|
||||
plugin_cleanup_func hookFunc;;
|
||||
RPMPLUGINS_SET_HOOK_FUNC(cleanup);
|
||||
if (hookFunc)
|
||||
rc = hookFunc();
|
||||
return rc;
|
||||
hookFunc();
|
||||
}
|
||||
|
||||
rpmRC rpmpluginsCallOpenTE(rpmPlugins plugins, const char *name, rpmte te)
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef rpmFlags rpmFsmOp;
|
|||
/* plugin hook typedefs */
|
||||
typedef rpmRC (*plugin_init_func)(rpmts ts,
|
||||
const char * name, const char * opts);
|
||||
typedef rpmRC (*plugin_cleanup_func)(void);
|
||||
typedef void (*plugin_cleanup_func)(void);
|
||||
typedef rpmRC (*plugin_opente_func)(rpmte te);
|
||||
typedef rpmRC (*plugin_coll_post_any_func)(void);
|
||||
typedef rpmRC (*plugin_coll_post_add_func)(void);
|
||||
|
|
|
@ -15,11 +15,10 @@ static rpmRC PLUGINHOOK_INIT_FUNC(rpmts ts, const char *name, const char *opts)
|
|||
return RPMRC_OK;
|
||||
}
|
||||
|
||||
static rpmRC PLUGINHOOK_CLEANUP_FUNC(void)
|
||||
static void PLUGINHOOK_CLEANUP_FUNC(void)
|
||||
{
|
||||
options = _free(options);
|
||||
name = _free(name);
|
||||
return RPMRC_OK;
|
||||
}
|
||||
|
||||
static rpmRC PLUGINHOOK_COLL_POST_ANY_FUNC(void)
|
||||
|
|
|
@ -629,12 +629,11 @@ static rpmRC PLUGINHOOK_INIT_FUNC(rpmts _ts, const char *_name, const char *_opt
|
|||
return RPMRC_OK;
|
||||
}
|
||||
|
||||
static rpmRC PLUGINHOOK_CLEANUP_FUNC(void)
|
||||
static void PLUGINHOOK_CLEANUP_FUNC(void)
|
||||
{
|
||||
_free(name);
|
||||
ts = NULL;
|
||||
policiesHead = policiesTail = sepolFree(policiesHead);
|
||||
return RPMRC_OK;
|
||||
}
|
||||
|
||||
static rpmRC PLUGINHOOK_OPENTE_FUNC(rpmte te)
|
||||
|
|
|
@ -16,10 +16,9 @@ static rpmRC PLUGINHOOK_INIT_FUNC(rpmts ts, const char * name, const char * opts
|
|||
return RPMRC_OK;
|
||||
}
|
||||
|
||||
static rpmRC PLUGINHOOK_CLEANUP_FUNC(void)
|
||||
static void PLUGINHOOK_CLEANUP_FUNC(void)
|
||||
{
|
||||
closelog();
|
||||
return RPMRC_OK;
|
||||
}
|
||||
|
||||
static rpmRC PLUGINHOOK_TSM_PRE_FUNC(rpmts ts)
|
||||
|
|
Loading…
Reference in New Issue