From def9c92cc0ed2cf06684b19e779e54eef9fa502e Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 31 Dec 2022 14:08:12 +0100 Subject: Fix C macro insanity No, you can't just use CMSG_SPACE inside the alloc call, it has to be stored in a variable first. --- src/ips/socketstream.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ips/socketstream.nim b/src/ips/socketstream.nim index 87fcb4e4..a2f80f01 100644 --- a/src/ips/socketstream.nim +++ b/src/ips/socketstream.nim @@ -58,7 +58,8 @@ proc sockClose(s: Stream) = {.cast(tags: []).}: #...sigh proc sendFileHandle*(s: SocketStream, fd: FileHandle) = var hdr: Tmsghdr var iov: IOVec - var cmsgbuf = alloc(CMSG_SPACE(csize_t(sizeof(FileHandle)))) + let space = CMSG_SPACE(csize_t(sizeof(FileHandle))) + var cmsgbuf = alloc(space) var buf = char(0) iov.iov_base = addr buf iov.iov_len = csize_t(1) -- cgit