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

Re: [libvirt] [PATCH 2/6] storage: fs: Fill in permissions on pool refresh



On Mon, Apr 27, 2015 at 16:48:40 -0400, Cole Robinson wrote:
> This means pool XML actually reports accurate user/group/mode/label.
> 
> This uses UpdateVolTargetInfoFD in a bit of a hackish way, but it works
> ---
>  src/storage/storage_backend_fs.c | 58 ++++++++++++++++++++++++++++++----------
>  1 file changed, 44 insertions(+), 14 deletions(-)
> 
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index 51d6bb3..804b7c3 100644
> --- a/src/storage/storage_backend_fs.c

...

> +    pool->def->target.perms.mode = target->perms->mode;
> +    pool->def->target.perms.uid = target->perms->uid;
> +    pool->def->target.perms.gid = target->perms->gid;
> +    VIR_FREE(pool->def->target.perms.label);
> +    if (VIR_STRDUP(pool->def->target.perms.label, target->perms->label) < 0)
> +        goto error;
>  
> +    ret = 0;
>   error:

Since both success and error paths use this label now, it should be
called 'cleanup';

>      if (dir)
>          closedir(dir);
> +    VIR_FORCE_CLOSE(fd);
>      virStorageVolDefFree(vol);
> -    virStoragePoolObjClearVols(pool);
> -    return -1;
> +    virStorageSourceFree(target);
> +    if (ret < 0)
> +        virStoragePoolObjClearVols(pool);
> +    return ret;
>  }

ACK with the label renamed.

Peter

Attachment: signature.asc
Description: Digital signature


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