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

Re: [libvirt] [PATCH 1/3] util: Report an error when virFileResolveLinkHelper's lstat fails



On Tue, Jun 20, 2017 at 17:03:30 +0200, Erik Skultety wrote:
> During investigation of [1] I saw nothing in the logs that would help me
> get to the root cause. Then I found out that we don't log anything when
> lstat fails. Sure, doesn't happen often, but if it happens we should
> reflect that in the logs to prevent spurious behaviour.
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1463285
> 
> Signed-off-by: Erik Skultety <eskultet redhat com>
> ---
>  src/util/virfile.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index d444b32f8..6bbcc3d15 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -1560,8 +1560,10 @@ virFileResolveLinkHelper(const char *linkpath,
>       * directories, if linkpath is absolute and the basename is
>       * already a non-symlink.  */
>      if (IS_ABSOLUTE_FILE_NAME(linkpath) && !intermediatePaths) {
> -        if (lstat(linkpath, &st) < 0)
> +        if (lstat(linkpath, &st) < 0) {
> +            virReportSystemError(errno, "%s", linkpath);
>              return -1;
> +        }

NACK, this function is designed not to report errors. It's even
documented so. Some other callers even report their own errors.

At most a VIR_DEBUG is appropriate here.

Attachment: signature.asc
Description: PGP signature


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