From 95c7627c8717f46bab8b23accfa9870d21ab4307 Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 3 Nov 2006 20:18:49 +0000 Subject: [PATCH] use FD_CLOEXEC instead of 1. --- lib/libc/db/btree/bt_open.c | 8 ++++---- lib/libc/db/hash/hash_page.c | 6 +++--- lib/libc/gen/syslog.c | 6 +++--- lib/libc/rpc/clnt_simple.c | 6 +++--- lib/libc/yp/yplib.c | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c index 9d4208afd3d2..ea04f9fb2e49 100644 --- a/lib/libc/db/btree/bt_open.c +++ b/lib/libc/db/btree/bt_open.c @@ -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 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)bt_open.c 8.10 (Berkeley) 8/17/94"; #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 /* LIBC_SCCS and not lint */ @@ -219,7 +219,7 @@ __bt_open(fname, flags, mode, openinfo, dflags) 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; if (fstat(t->bt_fd, &sb)) @@ -413,7 +413,7 @@ tmp() (void)sigprocmask(SIG_BLOCK, &set, &oset); if ((fd = mkstemp(path)) != -1) { (void)unlink(path); - (void)fcntl(fd, F_SETFD, 1); + (void)fcntl(fd, F_SETFD, FD_CLOEXEC); } (void)sigprocmask(SIG_SETMASK, &oset, NULL); return(fd); diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c index bfd148f7ede0..f1b3b7ad4ce1 100644 --- a/lib/libc/db/hash/hash_page.c +++ b/lib/libc/db/hash/hash_page.c @@ -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 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94"; #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 /* LIBC_SCCS and not lint */ @@ -895,7 +895,7 @@ open_temp(hashp) (void)sigprocmask(SIG_BLOCK, &set, &oset); if ((hashp->fp = mkstemp(namestr)) != -1) { (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); return (hashp->fp != -1 ? 0 : -1); diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index f4fce93950d7..3c1c863b0f96 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -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 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/29/95"; #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 /* 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 = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) return; - (void)fcntl(data->log_file, F_SETFD, 1); + (void)fcntl(data->log_file, F_SETFD, FD_CLOEXEC); data->connected = 0; } if (!data->connected) { diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c index 05f7a2038184..3451f9b19b3c 100644 --- a/lib/libc/rpc/clnt_simple.c +++ b/lib/libc/rpc/clnt_simple.c @@ -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 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)clnt_simple.c 1.49 89/01/31 Copyr 1984 Sun Micro"; #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 @@ -192,7 +192,7 @@ rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype) (void) CLNT_CONTROL(rcp->client, CLSET_RETRY_TIMEOUT, (char *)(void *)&timeout); 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->versnum = versnum; if ((strlen(host) < (size_t)MAXHOSTNAMELEN) && diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index fb48310adb9b..ea92f5078c2f 100644 --- a/lib/libc/yp/yplib.c +++ b/lib/libc/yp/yplib.c @@ -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 @@ -28,7 +28,7 @@ #include #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 #include "namespace.h" @@ -251,7 +251,7 @@ gotit: ysd->dom_vers = -1; 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"); if (new) {