Signed-off-by: Michael Jeanson <[email protected]>
---
 include/babeltrace/compat/stdlib.h | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/include/babeltrace/compat/stdlib.h 
b/include/babeltrace/compat/stdlib.h
index 57f942d..be0518f 100644
--- a/include/babeltrace/compat/stdlib.h
+++ b/include/babeltrace/compat/stdlib.h
@@ -25,16 +25,34 @@
  * SOFTWARE.
  */
 
+/*
+ * This compat wrapper can be removed and replaced by g_mkdtemp() when we bump
+ * the requirement on glib to version 2.30.
+ */
+
 #include <stdlib.h>
 #include <sys/stat.h>
+#include <glib.h>
 
 #ifdef HAVE_MKDTEMP
+
 static inline
 char *bt_mkdtemp(char *template)
 {
        return mkdtemp(template);
 }
+
+#elif GLIB_CHECK_VERSION(2,30,0)
+
+#include <glib/gstdio.h>
+static inline
+char *bt_mkdtemp(char *template)
+{
+       return g_mkdtemp(template);
+}
+
 #else
+
 static inline
 char *bt_mkdtemp(char *template)
 {
@@ -54,7 +72,7 @@ char *bt_mkdtemp(char *template)
 end:
        return ret;
 }
-#endif
 
+#endif
 
 #endif /* _BABELTRACE_COMPAT_STDLIB_H */
-- 
2.7.4

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to