-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
srcpkgs/ldc/patches/54544260a848c8ebad5582e27ac1e09627cdfb17.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
From 54544260a848c8ebad5582e27ac1e09627cdfb17 Mon Sep 17 00:00:00 2001 | ||
From: Razvan Nitu <razvan.nitu1305@gmail.com> | ||
Date: Wed, 24 Aug 2022 13:54:15 +0300 | ||
Subject: [PATCH] Port the fix for issue 23157 (#14378) | ||
|
||
--- | ||
druntime/src/core/sys/posix/sys/socket.d | 36 ++++++++++++++++++++++-- | ||
1 file changed, 33 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/druntime/src/core/sys/posix/sys/socket.d b/druntime/src/core/sys/posix/sys/socket.d | ||
index 3a7b753adff..fc5dc5d1684 100644 | ||
--- a/runtime/druntime/src/core/sys/posix/sys/socket.d | ||
+++ b/runtime/druntime/src/core/sys/posix/sys/socket.d | ||
@@ -188,10 +188,40 @@ version (linux) | ||
|
||
extern (D) inout(ubyte)* CMSG_DATA( return scope inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); } | ||
|
||
- private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc; | ||
- extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc | ||
+ version (CRuntime_Musl) | ||
{ | ||
- return __cmsg_nxthdr(msg, cmsg); | ||
+ extern (D) | ||
+ { | ||
+ private size_t __CMSG_LEN(inout(cmsghdr)* cmsg) pure nothrow @nogc | ||
+ { | ||
+ return (cmsg.cmsg_len + size_t.sizeof -1) & cast(size_t)(~(size_t.sizeof - 1)); | ||
+ } | ||
+ | ||
+ private inout(cmsghdr)* __CMSG_NEXT(inout(cmsghdr)* cmsg) pure nothrow @nogc | ||
+ { | ||
+ return cmsg + __CMSG_LEN(cmsg); | ||
+ } | ||
+ | ||
+ private inout(msghdr)* __MHDR_END(inout(msghdr)* mhdr) pure nothrow @nogc | ||
+ { | ||
+ return cast(inout(msghdr)*)(mhdr.msg_control + mhdr.msg_controllen); | ||
+ } | ||
+ | ||
+ inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc | ||
+ { | ||
+ return cmsg.cmsg_len < cmsghdr.sizeof || | ||
+ __CMSG_LEN(cmsg) + cmsghdr.sizeof >= __MHDR_END(msg) - cast(inout(msghdr)*)(cmsg) | ||
+ ? cast(inout(cmsghdr)*) null : cast(inout(cmsghdr)*) __CMSG_NEXT(cmsg); | ||
+ } | ||
+ } | ||
+ } | ||
+ else | ||
+ { | ||
+ private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc; | ||
+ extern (D) inout(cmsghdr)* CMSG_NXTHDR(inout(msghdr)* msg, inout(cmsghdr)* cmsg) pure nothrow @nogc | ||
+ { | ||
+ return __cmsg_nxthdr(msg, cmsg); | ||
+ } | ||
} | ||
|
||
extern (D) inout(cmsghdr)* CMSG_FIRSTHDR( inout(msghdr)* mhdr ) pure nothrow @nogc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters