[libvirt] [PATCH] cgroup: Add missing errno == ENOENT check in virCgroupRemoveRecursively

Eric Blake eblake at redhat.com
Mon Jun 28 16:41:26 UTC 2010


On 06/26/2010 11:21 AM, Ryota Ozaki wrote:
> ENOENT happens normally when a subsystem is enabled with any other
> subsystems and the directory of the target group has already removed
> in a prior loop. In that case, the function should just return without
> leaving an error message.
> 
> NB this is the same behavior as before introducing virCgroupRemoveRecursively.
> ---
>  src/util/cgroup.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/util/cgroup.c b/src/util/cgroup.c
> index 62b1446..9fa64dc 100644
> --- a/src/util/cgroup.c
> +++ b/src/util/cgroup.c
> @@ -616,6 +616,8 @@ static int virCgroupRemoveRecursively(char *grppath)
>  
>      grpdir = opendir(grppath);
>      if (grpdir == NULL) {
> +        if (errno == ENOENT)
> +            return 0;

Shouldn't this be continue instead of return 0, so as to go on to the
next readdir() in case there is anything else in the directory?

Also, right now, your cgroup recursive delete is breaking compilation on
mingw, which lacks d_type.  Obviously, since mingw also lacks cgroup
altogether, we can make things conditional, but I haven't had time to
look into the correct fix for that yet.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100628/e9434a56/attachment-0001.sig>


More information about the libvir-list mailing list