about summary refs log tree commit diff stats
path: root/src/ips
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-31 14:08:12 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-31 14:08:12 +0100
commitdef9c92cc0ed2cf06684b19e779e54eef9fa502e (patch)
tree72c1d6f093c8b8a77561eb771bc037b75a46a464 /src/ips
parent7b6a2c6d4d1d055953d1e72ca6096490f368f922 (diff)
downloadchawan-def9c92cc0ed2cf06684b19e779e54eef9fa502e.tar.gz
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.
Diffstat (limited to 'src/ips')
-rw-r--r--src/ips/socketstream.nim3
1 files changed, 2 insertions, 1 deletions
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)