From 01cef504dd23de745b1a7e7096a6dfb1f07f35ae Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 1 Apr 2020 00:29:36 +0900 Subject: Fixed FTBFS in recent distros caused by flex arrays usage in kppp. Based on the suggestion found here: https://github.com/UAVCAN/libuavcan/issues/116#issuecomment-346879320 (thanks!) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michele Calgaro Signed-off-by: Slávek Banko --- kppp/opener.cpp | 8 +++++++- kppp/requester.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'kppp') diff --git a/kppp/opener.cpp b/kppp/opener.cpp index 5d90cc0e..7628681b 100644 --- a/kppp/opener.cpp +++ b/kppp/opener.cpp @@ -342,7 +342,13 @@ void Opener::mainLoop() { // int Opener::sendFD(int fd, struct ResponseHeader *response) { - struct { struct cmsghdr cmsg; int fd; } control; + union { + struct { + char _cmsg[sizeof(struct cmsghdr)]; + char data[sizeof(int)]; // int fd field + }; + struct cmsghdr cmsg; + } control; struct msghdr msg; struct iovec iov; diff --git a/kppp/requester.cpp b/kppp/requester.cpp index b5450929..016d72fa 100644 --- a/kppp/requester.cpp +++ b/kppp/requester.cpp @@ -80,7 +80,13 @@ Requester::~Requester() { // Receive file name and file descriptors from envoy // int Requester::recvFD() { - struct { struct cmsghdr cmsg; int fd; } control; + union { + struct { + char _cmsg[sizeof(struct cmsghdr)]; + char data[sizeof(int)]; // int fd field + }; + struct cmsghdr cmsg; + } control; struct msghdr msg; struct ResponseHeader response; -- cgit v1.2.1