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!)

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 01cef504dd)
pull/38/head
Michele Calgaro 5 years ago
parent 27d394630c
commit 05d19ce725
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -342,7 +342,13 @@ void Opener::mainLoop() {
// //
int Opener::sendFD(int fd, struct ResponseHeader *response) { 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 msghdr msg;
struct iovec iov; struct iovec iov;

@ -80,7 +80,13 @@ Requester::~Requester() {
// Receive file name and file descriptors from envoy // Receive file name and file descriptors from envoy
// //
int Requester::recvFD() { 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 msghdr msg;
struct ResponseHeader response; struct ResponseHeader response;

Loading…
Cancel
Save