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

Chris Lalancette clalance at redhat.com
Thu Jan 21 18:02:17 UTC 2010


On 01/21/2010 12:24 PM, Jamie Strandboge wrote:
> 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'.

Yeah, it doesn't really matter to me either way.  I'll fold your suggested
change in when I apply.

Thanks for the review.

-- 
Chris Lalancette




More information about the libvir-list mailing list