Changeset: 70ad32f2840b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=70ad32f2840b
Modified Files:
        common/utils/mutils.c
        gdk/gdk_posix.c
        gdk/gdk_storage.c
        monetdb5/mal/mal_linker.c
        tools/merovingian/daemon/handlers.c
        tools/merovingian/daemon/merovingian.c
        tools/merovingian/utils/utils.c
Branch: Jul2017
Log Message:

Define O_CLOEXEC if not done already.


diffs (118 lines):

diff --git a/common/utils/mutils.c b/common/utils/mutils.c
--- a/common/utils/mutils.c
+++ b/common/utils/mutils.c
@@ -37,6 +37,10 @@
 # include <sys/sysctl.h>  /* KERN_PROC_PATHNAME on BSD */
 #endif
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 #ifdef NATIVE_WIN32
 
 /* Some definitions that we need to compile on Windows.
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -66,6 +66,10 @@
 #define MMAP_ADVISE            7
 #define MMAP_WRITABLE          (MMAP_WRITE|MMAP_COPY)
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 /* DDALERT: AIX4.X 64bits needs HAVE_SETENV==0 due to a AIX bug, but
  * it probably isn't detected so by configure */
 
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -33,6 +33,10 @@
 #include <fcntl.h>
 #endif
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 /* GDKfilepath returns a newly allocated string containing the path
  * name of a database farm.
  * The arguments are the farmID or -1, the name of a subdirectory
diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -44,6 +44,10 @@ static FileRecord filesLoaded[MAXMODULES
 static int maxfiles = MAXMODULES;
 static int lastfile = 0;
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 /*
  * returns 1 if the file exists
  */
diff --git a/tools/merovingian/daemon/handlers.c 
b/tools/merovingian/daemon/handlers.c
--- a/tools/merovingian/daemon/handlers.c
+++ b/tools/merovingian/daemon/handlers.c
@@ -23,6 +23,10 @@
 #include "merovingian.h"
 #include "handlers.h"
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 
 static const char *sigint  = "SIGINT";
 static const char *sigterm = "SIGTERM";
@@ -149,6 +153,9 @@ void reinitialize(void)
                Mfprintf(stderr, "forced to ignore SIGHUP: unable to open "
                                "'%s': %s\n", f, strerror(errno));
        } else {
+#if O_CLOEXEC == 0
+               fcntl(t, F_SETFD, FD_CLOEXEC);
+#endif
                Mfprintf(_mero_logfile, "%s END merovingian[" LLFMT "]: "
                                "caught SIGHUP, closing logfile\n",
                                mytime, (long long int)_mero_topdp->next->pid);
diff --git a/tools/merovingian/daemon/merovingian.c 
b/tools/merovingian/daemon/merovingian.c
--- a/tools/merovingian/daemon/merovingian.c
+++ b/tools/merovingian/daemon/merovingian.c
@@ -80,6 +80,10 @@
 #include "argvcmds.h"
 #include "multiplex-funnel.h"
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 
 /* private structs */
 
@@ -662,6 +666,9 @@ main(int argc, char *argv[])
                                p, strerror(errno));
                MERO_EXIT_CLEAN(1);
        }
+#if O_CLOEXEC == 0
+       fcntl(_mero_topdp->ou, F_SETFD< FD_CLOEXEC);
+#endif
        _mero_topdp->err = _mero_topdp->out;
 
        _mero_logfile = fdopen(_mero_topdp->out, "a");
diff --git a/tools/merovingian/utils/utils.c b/tools/merovingian/utils/utils.c
--- a/tools/merovingian/utils/utils.c
+++ b/tools/merovingian/utils/utils.c
@@ -43,6 +43,10 @@
 #endif
 #endif
 
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 /**
  * Parses the given file stream matching the keys from list.  If a match
  * is found, the value is set in list->value.  Values are malloced.
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to