Change-Id: I15005181388280363f7aee546bd2ecc0cd5b37e6
dbp = NULL;
/* Open the user's file -- if this fails, we're done. */
if (fname != NULL) {
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
if ((rfd = open(fname, flags | O_CLOEXEC, mode)) == -1)
return NULL;
+#if O_CLOEXEC == 0
+ if (fcntl(rfd, F_SETFD, FD_CLOEXEC) == -1)
+ goto err;
+#endif
}
/* Create a btree in memory (backed by disk). */
* and ".." are all fairly nasty problems. Note, if we can't get the
* descriptor we run anyway, just more slowly.
*/
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
if (!ISSET(FTS_NOCHDIR)) {
if ((sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC, 0)) == -1)
SET(FTS_NOCHDIR);
#include <sys/featuretest.h>
#include <sys/types.h>
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
#endif
#include "reentrant.h"