summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-02-15 20:14:50 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-02-15 20:14:50 +0000
commit19c62155db3f3c559d77f5fad61db549a7cfd78d (patch)
tree3fab616da8da0750bd559fdca0463b69b9c17f72 /usr.bin
parent0e56d20dc864c1695a2ae919a744e52604fb25e6 (diff)
set the close-on-exec flag on the parent's local socket descriptor
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/sock.c10
1 files changed, 7 insertions, 3 deletions
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 <jfb@openbsd.org>
* All rights reserved.
@@ -29,11 +29,12 @@
#include <sys/un.h>
#include <poll.h>
-#include <stdlib.h>
+#include <errno.h>
#include <stdio.h>
+#include <fcntl.h>
#include <unistd.h>
-#include <errno.h>
#include <string.h>
+#include <stdlib.h>
#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);