[libvirt] [PATCHv2] selinux: Don't mask errors of virSecuritySELinuxGenNewContext

Osier Yang jyang at redhat.com
Wed Apr 24 13:59:15 UTC 2013


On 24/04/13 21:11, Peter Krempa wrote:
> Since cbe67ff9b0a5a94911afd4d12388bf182bcca86c
> virSecuritySELinuxGenNewContext reports good error messages. Fix callers
> that mask the errors by generic error message.
> ---
>   src/security/security_selinux.c | 14 ++++----------
>   1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
> index c620a2e..61ff1de 100644
> --- a/src/security/security_selinux.c
> +++ b/src/security/security_selinux.c
> @@ -685,13 +685,10 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
>               }
>           }
>
> -        seclabel->label =
> -            virSecuritySELinuxGenNewContext(baselabel, mcs, false);
> -        if (!seclabel->label)  {
> -            virReportError(VIR_ERR_INTERNAL_ERROR,
> -                           _("cannot generate selinux context for %s"), mcs);
> +        seclabel->label = virSecuritySELinuxGenNewContext(baselabel, mcs, false);
> +        if (!seclabel->label)
>               goto cleanup;
> -        }
> +
>           break;
>
>       case VIR_DOMAIN_SECLABEL_NONE:
> @@ -709,11 +706,8 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
>           seclabel->imagelabel = virSecuritySELinuxGenNewContext(data->file_context,
>                                                                  mcs,
>                                                                  true);
> -        if (!seclabel->imagelabel)  {
> -            virReportError(VIR_ERR_INTERNAL_ERROR,
> -                           _("cannot generate selinux context for %s"), mcs);
> +        if (!seclabel->imagelabel)
>               goto cleanup;
> -        }
>       }
>
>       if (!seclabel->model &&
ACK




More information about the libvir-list mailing list