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

[libvirt] [PATCH] Fix virCgroupAvailable() w/o HAVE_GETMNTENT_R defined



virCgroupAvailable() implementation calls getmntent_r
without checking if HAVE_GETMNTENT_R is defined, so it fails
to build on platforms without getmntent_r support.

Make virCgroupAvailable() just return false without
HAVE_GETMNTENT_R.
---
 src/util/vircgroup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 5251611..d328212 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -69,9 +69,10 @@ typedef enum {
 
 bool virCgroupAvailable(void)
 {
+    bool ret = false;
+#ifdef HAVE_GETMNTENT_R
     FILE *mounts = NULL;
     struct mntent entry;
-    bool ret = false;
     char buf[CGROUP_MAX_VAL];
 
     if (!virFileExists("/proc/cgroups"))
@@ -88,6 +89,7 @@ bool virCgroupAvailable(void)
     }
 
     VIR_FORCE_FCLOSE(mounts);
+#endif
     return ret;
 }
 
-- 
1.7.11.5


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