Re: [PATCH v3 3/9] qemu: add helper for getting guest users

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

 



[...]

>> +
>> +static int getUserInfo(virTypedParameterPtr params, int nparams,
>> size_t nth,
>> +                       const char **username, const char **domain,
>> +                       unsigned long long *logintime)
>> +{
>> +    char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
>> +
>> +    snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
>> +             "user.%zu.name", nth);
>> +    if (username &&
>> +        virTypedParamsGetString(params, nparams, param_name,
>> username) < 0)
>> +        return -1;
>> +
>> +    snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
>> +             "user.%zu.domain", nth);
>> +    if (domain &&
>> +        virTypedParamsGetString(params, nparams, param_name, domain)
>> < 0)
>> +        return -1;
>> +
>> +    snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
>> +             "user.%zu.login-time", nth);
>> +    if (logintime &&
>> +        virTypedParamsGetULLong(params, nparams, param_name,
>> logintime) < 0)
>> +        return -1;
>> +
>> +    return 0;
> 
> This function can be renamed to checkUserInfo() and it can check the
> values directly. It saves us couple of more lines.
> 

Changes made to this function after review, but not posted AFAICT
neglected to check the return value of virTypedParamsGetString for
"user.%zu.domain" like the other two calls checked, so Coverity noted that.

John

>> +}
>> +
> 
> Michal
> 
> -- 
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

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

  Powered by Linux