From d6055480175938d9d8d968db326469833cff5bf3 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 20 Nov 2019 01:10:10 -0800 Subject: Avoid a couple VLAs with constant size These are really just regular arrays masquerading as VLAs. --- dispatch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'dispatch.c') diff --git a/dispatch.c b/dispatch.c index d762105..c2e2d50 100644 --- a/dispatch.c +++ b/dispatch.c @@ -58,8 +58,7 @@ static void eventRemove(size_t i) { } static ssize_t sendfd(int sock, int fd) { - size_t len = CMSG_SPACE(sizeof(int)); - char buf[len]; + char buf[CMSG_SPACE(sizeof(int))]; char x = 0; struct iovec iov = { .iov_base = &x, .iov_len = 1 }; @@ -67,7 +66,7 @@ static ssize_t sendfd(int sock, int fd) { .msg_iov = &iov, .msg_iovlen = 1, .msg_control = buf, - .msg_controllen = len, + .msg_controllen = sizeof(buf), }; struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); -- cgit 1.4.1