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

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

 



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@xxxxxxxxxx>
---
 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;
+        }
 
         if (!S_ISLNK(st.st_mode))
             return VIR_STRDUP_QUIET(*resultpath, linkpath) < 0 ? -1 : 0;
-- 
2.13.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux