[libvirt] [PATCH 10/18] Use virDirOpenQuiet

Ján Tomko jtomko at redhat.com
Fri Jun 24 12:18:39 UTC 2016


On Thu, Jun 23, 2016 at 08:36:21AM -0400, John Ferlan wrote:
>
>
>On 06/21/2016 12:05 PM, Ján Tomko wrote:
>> Remove all the remaining usage of opendir.
>> ---
>>  src/openvz/openvz_conf.c      | 3 +--
>>  src/qemu/qemu_hostdev.c       | 2 +-
>>  src/storage/storage_backend.c | 2 +-
>>  src/util/vircgroup.c          | 3 +--
>>  src/util/virhostcpu.c         | 2 +-
>>  src/util/virpci.c             | 2 +-
>>  6 files changed, 6 insertions(+), 8 deletions(-)
>>
>
>[...]
>
>> diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
>> index 634f659..da20ba5 100644
>> --- a/src/util/vircgroup.c
>> +++ b/src/util/vircgroup.c
>> @@ -3378,8 +3378,7 @@ virCgroupRemoveRecursively(char *grppath)
>>      int rc = 0;
>>      int direrr;
>>
>> -    grpdir = opendir(grppath);
>> -    if (grpdir == NULL) {
>> +    if (virDirOpenQuiet(&grpdir, grppath) < 0) {
>>          if (errno == ENOENT)
>>              return 0;
>
>This one seems to be an ENOENT case...
>

The IfExists version is not quiet.

Instead of introducing another helper, I've left this one open-coded
until someone rewrites the virCgroup* APIs to report errors.

Jan




More information about the libvir-list mailing list