[libvirt] [PATCH] virhostuptime: Wrap virHostGetBootTimeProcfs() call in an ifdef

Michal Privoznik posted 1 patch 4 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1b0de07f41bbe0d23ab96b604428ae55fd22aec0.1573746265.git.mprivozn@redhat.com
src/util/virhostuptime.c | 2 ++
1 file changed, 2 insertions(+)
[libvirt] [PATCH] virhostuptime: Wrap virHostGetBootTimeProcfs() call in an ifdef
Posted by Michal Privoznik 4 years, 5 months ago
The virHostGetBootTimeProcfs() function is defined only for Linux
and therefore it's only call should also be done if we're on
Linux.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

Pushed under trivial rule.

 src/util/virhostuptime.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/virhostuptime.c b/src/util/virhostuptime.c
index 056b5c591a..8c49c3d40e 100644
--- a/src/util/virhostuptime.c
+++ b/src/util/virhostuptime.c
@@ -99,8 +99,10 @@ virHostGetBootTimeOnceInit(void)
     endutxent();
 # endif /* HAVE_GETUTXID */
 
+# ifdef __linux__
     if (bootTimeErrno != 0 || bootTime == 0)
         bootTimeErrno = -virHostGetBootTimeProcfs(&bootTime);
+# endif /* __linux__ */
 }
 
 #else /* !defined(HAVE_GETUTXID) && !defined(__linux__) */
-- 
2.23.0

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