libc: revert inadvertent removal of O_CLOEXEC #ifndefs
Change-Id: I15005181388280363f7aee546bd2ecc0cd5b37e6
This commit is contained in:
parent
714dd83efe
commit
2a8a99cc6a
3 changed files with 14 additions and 0 deletions
|
@ -70,8 +70,15 @@ __rec_open(const char *fname, int flags, mode_t mode, const RECNOINFO *openinfo,
|
||||||
dbp = NULL;
|
dbp = NULL;
|
||||||
/* Open the user's file -- if this fails, we're done. */
|
/* Open the user's file -- if this fails, we're done. */
|
||||||
if (fname != NULL) {
|
if (fname != NULL) {
|
||||||
|
#ifndef O_CLOEXEC
|
||||||
|
#define O_CLOEXEC 0
|
||||||
|
#endif
|
||||||
if ((rfd = open(fname, flags | O_CLOEXEC, mode)) == -1)
|
if ((rfd = open(fname, flags | O_CLOEXEC, mode)) == -1)
|
||||||
return NULL;
|
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). */
|
/* Create a btree in memory (backed by disk). */
|
||||||
|
|
|
@ -213,6 +213,9 @@ fts_open(char * const *argv, int options,
|
||||||
* and ".." are all fairly nasty problems. Note, if we can't get the
|
* and ".." are all fairly nasty problems. Note, if we can't get the
|
||||||
* descriptor we run anyway, just more slowly.
|
* descriptor we run anyway, just more slowly.
|
||||||
*/
|
*/
|
||||||
|
#ifndef O_CLOEXEC
|
||||||
|
#define O_CLOEXEC 0
|
||||||
|
#endif
|
||||||
if (!ISSET(FTS_NOCHDIR)) {
|
if (!ISSET(FTS_NOCHDIR)) {
|
||||||
if ((sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC, 0)) == -1)
|
if ((sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC, 0)) == -1)
|
||||||
SET(FTS_NOCHDIR);
|
SET(FTS_NOCHDIR);
|
||||||
|
|
|
@ -42,6 +42,10 @@ __RCSID("$NetBSD: initdir.c,v 1.3 2012/03/13 21:13:36 christos Exp $");
|
||||||
#include <sys/featuretest.h>
|
#include <sys/featuretest.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#ifndef O_CLOEXEC
|
||||||
|
#define O_CLOEXEC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "reentrant.h"
|
#include "reentrant.h"
|
||||||
|
|
Loading…
Reference in a new issue