[sysprof] platform: handle some differences on macOS



commit b8950c9409afcd63e24f7315c697a20ce8c9af41
Author: Christian Hergert <chergert redhat com>
Date:   Mon Nov 16 14:13:50 2020 -0800

    platform: handle some differences on macOS

 src/libsysprof-capture/sysprof-platform.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/libsysprof-capture/sysprof-platform.c b/src/libsysprof-capture/sysprof-platform.c
index a80ab89..fa868a2 100644
--- a/src/libsysprof-capture/sysprof-platform.c
+++ b/src/libsysprof-capture/sysprof-platform.c
@@ -56,6 +56,7 @@
 
 #include "config.h"
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <sys/syscall.h>
 #include <unistd.h>
@@ -103,6 +104,7 @@ sysprof_memfd_create (const char *name)
   return syscall (__NR_memfd_create, name, 0);
 #else
   int fd;
+  int flags;
   const char *tmpdir;
   char *template = NULL;
   size_t template_len = 0;
@@ -127,7 +129,13 @@ sysprof_memfd_create (const char *name)
 
   snprintf (template, template_len, "%s/sysprof-XXXXXX", tmpdir);
 
-  fd = TEMP_FAILURE_RETRY (mkostemp (template, O_BINARY | O_CLOEXEC));
+#ifdef __APPLE__
+  flags = 0;
+#else
+  flags = O_BINARY | O_CLOEXEC;
+#endif
+
+  fd = TEMP_FAILURE_RETRY (mkostemp (template, flags));
   if (fd < 0)
     {
       free (template);


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