Changeset: 668fd9dc0b61 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=668fd9dc0b61
Modified Files:
        tools/merovingian/daemon/merovingian.c
Branch: Jul2017
Log Message:

Don't use fcntl with F_DUPFD(_CLOEXEC) but use old-fashioned dup().
The old code caused a crash on Solaris because the call to fcntl failed
and hence the fdopen returned NULL.


diffs (29 lines):

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
@@ -83,9 +83,6 @@
 #ifndef O_CLOEXEC
 #define O_CLOEXEC 0
 #endif
-#ifndef F_DUPFD_CLOEXEC
-#define F_DUPFD_CLOEXEC F_DUPFD
-#endif
 
 
 /* private structs */
@@ -696,10 +693,12 @@ main(int argc, char *argv[])
                MERO_EXIT(1);
        }
        /* before it is too late, save original stderr */
-       oerr = fdopen(fcntl(2, F_DUPFD_CLOEXEC), "w");
-#if F_DUPFD_CLOEXEC == F_DUPFD
+       oerr = fdopen(dup(2), "w");
+       if (oerr == NULL) {
+               Mfprintf(stderr, "unable to dup stderr\n");
+               MERO_EXIT(1);
+       }
        fcntl(fileno(oerr), F_SETFD, FD_CLOEXEC);
-#endif
        d->err = pfd[0];
        fcntl(pfd[0], F_SETFD, FD_CLOEXEC);
        dup2(pfd[1], 2);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to