use FD_CLOEXEC instead of 1.

This commit is contained in:
christos 2006-11-03 20:18:49 +00:00
parent 96b4176078
commit 95c7627c87
5 changed files with 16 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_open.c,v 1.19 2006/03/26 02:03:40 rtr Exp $ */ /* $NetBSD: bt_open.c,v 1.20 2006/11/03 20:18:49 christos Exp $ */
/*- /*-
* Copyright (c) 1990, 1993, 1994 * Copyright (c) 1990, 1993, 1994
@ -37,7 +37,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)bt_open.c 8.10 (Berkeley) 8/17/94"; static char sccsid[] = "@(#)bt_open.c 8.10 (Berkeley) 8/17/94";
#else #else
__RCSID("$NetBSD: bt_open.c,v 1.19 2006/03/26 02:03:40 rtr Exp $"); __RCSID("$NetBSD: bt_open.c,v 1.20 2006/11/03 20:18:49 christos Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -219,7 +219,7 @@ __bt_open(fname, flags, mode, openinfo, dflags)
F_SET(t, B_INMEM); F_SET(t, B_INMEM);
} }
if (fcntl(t->bt_fd, F_SETFD, 1) == -1) if (fcntl(t->bt_fd, F_SETFD, FD_CLOEXEC) == -1)
goto err; goto err;
if (fstat(t->bt_fd, &sb)) if (fstat(t->bt_fd, &sb))
@ -413,7 +413,7 @@ tmp()
(void)sigprocmask(SIG_BLOCK, &set, &oset); (void)sigprocmask(SIG_BLOCK, &set, &oset);
if ((fd = mkstemp(path)) != -1) { if ((fd = mkstemp(path)) != -1) {
(void)unlink(path); (void)unlink(path);
(void)fcntl(fd, F_SETFD, 1); (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
} }
(void)sigprocmask(SIG_SETMASK, &oset, NULL); (void)sigprocmask(SIG_SETMASK, &oset, NULL);
return(fd); return(fd);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash_page.c,v 1.18 2006/03/26 02:00:37 rtr Exp $ */ /* $NetBSD: hash_page.c,v 1.19 2006/11/03 20:18:49 christos Exp $ */
/*- /*-
* Copyright (c) 1990, 1993, 1994 * Copyright (c) 1990, 1993, 1994
@ -37,7 +37,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94"; static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94";
#else #else
__RCSID("$NetBSD: hash_page.c,v 1.18 2006/03/26 02:00:37 rtr Exp $"); __RCSID("$NetBSD: hash_page.c,v 1.19 2006/11/03 20:18:49 christos Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -895,7 +895,7 @@ open_temp(hashp)
(void)sigprocmask(SIG_BLOCK, &set, &oset); (void)sigprocmask(SIG_BLOCK, &set, &oset);
if ((hashp->fp = mkstemp(namestr)) != -1) { if ((hashp->fp = mkstemp(namestr)) != -1) {
(void)unlink(namestr); (void)unlink(namestr);
(void)fcntl(hashp->fp, F_SETFD, 1); (void)fcntl(hashp->fp, F_SETFD, FD_CLOEXEC);
} }
(void)sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL); (void)sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
return (hashp->fp != -1 ? 0 : -1); return (hashp->fp != -1 ? 0 : -1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: syslog.c,v 1.36 2006/11/02 20:36:29 christos Exp $ */ /* $NetBSD: syslog.c,v 1.37 2006/11/03 20:18:49 christos Exp $ */
/* /*
* Copyright (c) 1983, 1988, 1993 * Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/29/95"; static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/29/95";
#else #else
__RCSID("$NetBSD: syslog.c,v 1.36 2006/11/02 20:36:29 christos Exp $"); __RCSID("$NetBSD: syslog.c,v 1.37 2006/11/03 20:18:49 christos Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -373,7 +373,7 @@ connectlog_r(struct syslog_data *data)
if (data->log_file == -1 || fcntl(data->log_file, F_GETFL, 0) == -1) { if (data->log_file == -1 || fcntl(data->log_file, F_GETFL, 0) == -1) {
if ((data->log_file = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) if ((data->log_file = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1)
return; return;
(void)fcntl(data->log_file, F_SETFD, 1); (void)fcntl(data->log_file, F_SETFD, FD_CLOEXEC);
data->connected = 0; data->connected = 0;
} }
if (!data->connected) { if (!data->connected) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: clnt_simple.c,v 1.27 2005/12/03 15:16:19 yamt Exp $ */ /* $NetBSD: clnt_simple.c,v 1.28 2006/11/03 20:18:49 christos Exp $ */
/* /*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -39,7 +39,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)clnt_simple.c 1.49 89/01/31 Copyr 1984 Sun Micro"; static char sccsid[] = "@(#)clnt_simple.c 1.49 89/01/31 Copyr 1984 Sun Micro";
#else #else
__RCSID("$NetBSD: clnt_simple.c,v 1.27 2005/12/03 15:16:19 yamt Exp $"); __RCSID("$NetBSD: clnt_simple.c,v 1.28 2006/11/03 20:18:49 christos Exp $");
#endif #endif
#endif #endif
@ -192,7 +192,7 @@ rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
(void) CLNT_CONTROL(rcp->client, (void) CLNT_CONTROL(rcp->client,
CLSET_RETRY_TIMEOUT, (char *)(void *)&timeout); CLSET_RETRY_TIMEOUT, (char *)(void *)&timeout);
if (CLNT_CONTROL(rcp->client, CLGET_FD, (char *)(void *)&fd)) if (CLNT_CONTROL(rcp->client, CLGET_FD, (char *)(void *)&fd))
fcntl(fd, F_SETFD, 1); /* make it "close on exec" */ (coid)fcntl(fd, F_SETFD, FD_CLOEXEC);
rcp->prognum = prognum; rcp->prognum = prognum;
rcp->versnum = versnum; rcp->versnum = versnum;
if ((strlen(host) < (size_t)MAXHOSTNAMELEN) && if ((strlen(host) < (size_t)MAXHOSTNAMELEN) &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: yplib.c,v 1.42 2004/10/29 06:32:09 lukem Exp $ */ /* $NetBSD: yplib.c,v 1.43 2006/11/03 20:18:49 christos Exp $ */
/* /*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca> * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yplib.c,v 1.42 2004/10/29 06:32:09 lukem Exp $"); __RCSID("$NetBSD: yplib.c,v 1.43 2006/11/03 20:18:49 christos Exp $");
#endif #endif
#include "namespace.h" #include "namespace.h"
@ -251,7 +251,7 @@ gotit:
ysd->dom_vers = -1; ysd->dom_vers = -1;
goto again; goto again;
} }
if (fcntl(ysd->dom_socket, F_SETFD, 1) == -1) if (fcntl(ysd->dom_socket, F_SETFD, FD_CLOEXEC) == -1)
perror("fcntl: F_SETFD"); perror("fcntl: F_SETFD");
if (new) { if (new) {