Re: [PATCH] selinux: Only create the selabel_handle once.

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

 



On Wed, Jan 23, 2013 at 08:12:25PM +0000, Richard W.M. Jones wrote:
> From: "Richard W.M. Jones" <rjones@xxxxxxxxxx>
> 
> According to Eric Paris this is slightly more efficient because it
> only loads the regular expressions in libselinux once.
> ---
>  src/security/security_selinux.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
> index a3ef728..8b88785 100644
> --- a/src/security/security_selinux.c
> +++ b/src/security/security_selinux.c
> @@ -935,20 +935,26 @@ virSecuritySELinuxFSetFilecon(int fd, char *tcon)
>      return 0;
>  }
>  
> +#if HAVE_SELINUX_LABEL_H
> +static struct selabel_handle *sehandle = NULL;
> +static virOnceControl sehandleonce = VIR_ONCE_CONTROL_INITIALIZER;
> +
> +static void
> +seHandleInit (void)
> +{
> +    sehandle = selabel_open(SELABEL_CTX_FILE, NULL, 0);
> +}
> +#endif

Eeek, please no more global variables - I only just finished removing
them all from this file. Put this in the virSecuritySELinuxData struct
instead.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]