libc: revert inadvertent removal of O_CLOEXEC #ifndefs
Change-Id: I15005181388280363f7aee546bd2ecc0cd5b37e6
This commit is contained in:
		
							parent
							
								
									714dd83efe
								
							
						
					
					
						commit
						2a8a99cc6a
					
				@ -70,8 +70,15 @@ __rec_open(const char *fname, int flags, mode_t mode, const RECNOINFO *openinfo,
 | 
			
		||||
	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). */
 | 
			
		||||
 | 
			
		||||
@ -213,6 +213,9 @@ fts_open(char * const *argv, int options,
 | 
			
		||||
	 * 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);
 | 
			
		||||
 | 
			
		||||
@ -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/types.h>
 | 
			
		||||
 | 
			
		||||
#ifndef O_CLOEXEC
 | 
			
		||||
#define O_CLOEXEC 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "reentrant.h"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user