Re: [libvirt PATCH] tests: refactor testSELinuxLoadDef

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux