Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
ab32d645
Commit
ab32d645
authored
Apr 21, 2019
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to fix Mac build moar hardar.
parent
d016d3f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
async-io-unix.c++
c++/src/kj/async-io-unix.c++
+7
-2
No files found.
c++/src/kj/async-io-unix.c++
View file @
ab32d645
...
...
@@ -366,11 +366,16 @@ private:
// SCM_CREDENTIALS. The sender decides what to send. They could send SCM_CREDENTIALS
// first followed by SCM_RIGHTS. We need to make sure we see both.
size_t
nfds
=
0
;
size_t
spaceLeft
=
msg
.
msg_controllen
;
for
(
struct
cmsghdr
*
cmsg
=
CMSG_FIRSTHDR
(
&
msg
);
cmsg
!=
nullptr
;
cmsg
=
CMSG_NXTHDR
(
&
msg
,
cmsg
))
{
if
(
cmsg
->
cmsg_level
==
SOL_SOCKET
&&
cmsg
->
cmsg_type
==
SCM_RIGHTS
)
{
if
(
spaceLeft
>=
CMSG_LEN
(
0
)
&&
cmsg
->
cmsg_level
==
SOL_SOCKET
&&
cmsg
->
cmsg_type
==
SCM_RIGHTS
)
{
// Some operating systems (like MacOS) do not adjust csmg_len when the message is
// truncated. We must do so ourselves or risk overrunning the buffer.
auto
len
=
kj
::
min
(
cmsg
->
cmsg_len
,
spaceLeft
);
auto
data
=
arrayPtr
(
reinterpret_cast
<
int
*>
(
CMSG_DATA
(
cmsg
)),
(
cmsg
->
cmsg_
len
-
CMSG_LEN
(
0
))
/
sizeof
(
int
));
(
len
-
CMSG_LEN
(
0
))
/
sizeof
(
int
));
kj
::
Vector
<
kj
::
AutoCloseFd
>
trashFds
;
for
(
auto
fd
:
data
)
{
kj
::
AutoCloseFd
ownFd
(
fd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment