From 19c62155db3f3c559d77f5fad61db549a7cfd78d Mon Sep 17 00:00:00 2001 From: Jean-Francois Brousseau Date: Tue, 15 Feb 2005 20:14:50 +0000 Subject: set the close-on-exec flag on the parent's local socket descriptor --- usr.bin/cvs/sock.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'usr.bin/cvs') diff --git a/usr.bin/cvs/sock.c b/usr.bin/cvs/sock.c index 98435a1aea6..5151a55624b 100644 --- a/usr.bin/cvs/sock.c +++ b/usr.bin/cvs/sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sock.c,v 1.10 2005/02/15 15:17:34 jfb Exp $ */ +/* $OpenBSD: sock.c,v 1.11 2005/02/15 20:14:49 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -29,11 +29,12 @@ #include #include -#include +#include #include +#include #include -#include #include +#include #include "log.h" #include "sock.h" @@ -107,6 +108,9 @@ cvsd_sock_open(void) return (-1); } + /* close on exec so children can't muck around with this */ + (void)fcntl(cvsd_sock, F_SETFD, FD_CLOEXEC); + cvs_log(LP_DEBUG, "opened local socket `%s'", cvsd_sock_path); return (0); -- cgit v1.2.3