[libvirt] [PATCH 1/3] util: Report an error when virFileResolveLinkHelper's lstat fails
Peter Krempa
pkrempa at redhat.com
Tue Jun 20 15:10:04 UTC 2017
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 at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170620/2e317842/attachment-0001.sig>
More information about the libvir-list
mailing list