[libvirt PATCH] tests: refactor testSELinuxLoadDef
Michal Prívozník
mprivozn at redhat.com
Mon Jan 31 16:42:15 UTC 2022
On 1/28/22 19:41, Ján Tomko wrote:
> Since its introduction in
> commit 907a39e735d256b8428ed4c77009d1f713aea19b
> Add a test suite for validating SELinux labelling
>
> this function did not return NULL on OOM.
>
> Since we abort on OOM now, switch testSELinuxMungePath to void,
> return NULL explicitly on XML parsing failure and remove
> the (now pointless) cleanup label.
>
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
> tests/securityselinuxlabeltest.c | 35 +++++++++++---------------------
> 1 file changed, 12 insertions(+), 23 deletions(-)
>
> diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
> index 09902e1c54..b62162fe9f 100644
> --- a/tests/securityselinuxlabeltest.c
> +++ b/tests/securityselinuxlabeltest.c
> @@ -82,16 +82,12 @@ testUserXattrEnabled(void)
> return ret;
> }
>
> -static int
> +static void
> testSELinuxMungePath(char **path)
> {
> - char *tmp;
> -
> - tmp = g_strdup_printf("%s/securityselinuxlabeldata%s", abs_builddir, *path);
> -
> - VIR_FREE(*path);
> + char *tmp = g_strdup_printf("%s/securityselinuxlabeldata%s", abs_builddir, *path);
> + g_free(*path);
> *path = tmp;
> - return 0;
nitpick: please keep that empty line between variable declaration block
and code block.
> }
Reviewed-by: Michal Privoznik <mprivozn at redhat.com>
Michal
More information about the libvir-list
mailing list