[libvirt] [PATCH v1 03/23] virSecurityDACSetOwnershipInternal: Don't chown so often

Peter Krempa pkrempa at redhat.com
Fri Oct 16 05:29:05 UTC 2015


On Mon, Oct 12, 2015 at 12:25:48 +0200, Michal Privoznik wrote:
> It's better if we stat() file that we are about to chown() at
> first and check if there's something we need to change. Not that
> it would make much difference, but for the upcoming patches we
> need to be doing stat() anyway.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/security/security_dac.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/src/security/security_dac.c b/src/security/security_dac.c
> index 0dfe570..9b079e0 100644
> --- a/src/security/security_dac.c
> +++ b/src/security/security_dac.c
> @@ -271,17 +271,18 @@ virSecurityDACSetOwnershipInternal(virSecurityDACDataPtr priv,
>              path = src->path;
>          }
>  
> +        if (stat(path, &sb) < 0) {
> +            virReportSystemError(errno, _("unable to stat: %s"), path);
> +            return -1;
> +        }

I'd like to see a more specific error message in terms of what is
happening at the point stat was called. Otherwise the message might be
too confusing at this point since it might have failed due to lack of
permissions actually.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151016/7bc735fc/attachment-0001.sig>


More information about the libvir-list mailing list