mirror of
https://github.com/openbsd/xenocara.git
synced 2025-12-12 04:09:15 +00:00
set MSG_CMSG_CLOEXEC when receiving file descriptors.
All file descriptors opened via priv_open_device() can benefit of the close-on-exec flag. ok kettenis@.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: privsep.c,v 1.28 2015/11/11 21:07:49 matthieu Exp $ */
|
||||
/* $OpenBSD: privsep.c,v 1.29 2018/08/06 20:11:34 matthieu Exp $ */
|
||||
/*
|
||||
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
|
||||
* All rights reserved.
|
||||
@@ -207,7 +207,7 @@ receive_fd(int s)
|
||||
msg.msg_controllen = sizeof(cmsgbuf.buf);
|
||||
|
||||
do
|
||||
n = recvmsg(s, &msg, 0);
|
||||
n = recvmsg(s, &msg, MSG_CMSG_CLOEXEC);
|
||||
while (n == -1 && errno == EINTR);
|
||||
|
||||
if (n != sizeof(int)) {
|
||||
|
||||
Reference in New Issue
Block a user