Re: [libvirt] [PATCH] Use virFileResolveLink instead of readlink in AppArmor

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

 



On Thu, 2010-01-21 at 11:33 -0500, Chris Lalancette wrote:

> --- a/src/security/security_apparmor.c
> +++ b/src/security/security_apparmor.c
> @@ -258,22 +258,23 @@ get_profile_name(virConnectPtr conn, virDomainObjPtr vm)
>  static int
>  use_apparmor(void)
>  {
> -    char libvirt_daemon[PATH_MAX];
>      int rc = -1;
> -    ssize_t len = 0;
> +    char *libvirt_daemon = NULL;
>  
> -    if ((len = readlink("/proc/self/exe", libvirt_daemon,
> -                        PATH_MAX - 1)) < 0) {
> +    if (virFileResolveLink("/proc/self/exe", &libvirt_daemon) < 0) {
>          virSecurityReportError(NULL, VIR_ERR_INTERNAL_ERROR,
>                                 "%s", _("could not find libvirtd"));
> -        return rc;
> +        return -1;

I've yet to test areadlink() from gnulib, but in the meantime, I'd
prefer if this were 'return rc' since rc is already '-1'.

Jamie

-- 
Jamie Strandboge             | http://www.canonical.com

Attachment: signature.asc
Description: This is a digitally signed message part

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