diff mbox series

[meta-networking,12/21] fping: Fix build with musl

Message ID 20220830071413.3887189-12-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,01/21] gtk+: Fix function signature of create_menu() | expand

Commit Message

Khem Raj Aug. 30, 2022, 7:14 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...lize-msghdr-struct-in-a-portable-way.patch | 42 +++++++++++++++++++
 .../recipes-support/fping/fping_5.1.bb        |  4 +-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-support/fping/fping/0001-fping-Initialize-msghdr-struct-in-a-portable-way.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/fping/fping/0001-fping-Initialize-msghdr-struct-in-a-portable-way.patch b/meta-networking/recipes-support/fping/fping/0001-fping-Initialize-msghdr-struct-in-a-portable-way.patch
new file mode 100644
index 0000000000..2a5b3e6193
--- /dev/null
+++ b/meta-networking/recipes-support/fping/fping/0001-fping-Initialize-msghdr-struct-in-a-portable-way.patch
@@ -0,0 +1,42 @@ 
+From c3f476a763412be51b4df0e748af04d4150a2c71 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 29 Aug 2022 15:41:51 -0700
+Subject: [PATCH] fping: Initialize msghdr struct in a portable way
+
+Initializing the structure assuming glibc layout results in
+compile errors on musl, therefore do partial intialization and then
+assigning the members individually.
+
+Upstream-status: Submitted [https://github.com/schweikert/fping/pull/263]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/fping.c | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/src/fping.c b/src/fping.c
+index e26b216..81a61d9 100644
+--- a/src/fping.c
++++ b/src/fping.c
+@@ -1951,15 +1951,13 @@ int receive_packet(int64_t wait_time,
+         reply_buf,
+         reply_buf_len
+     };
+-    struct msghdr recv_msghdr = {
+-        reply_src_addr,
+-        reply_src_addr_len,
+-        &msg_iov,
+-        1,
+-        &msg_control,
+-        sizeof(msg_control),
+-        0
+-    };
++    struct msghdr recv_msghdr = {0};
++    recv_msghdr.msg_name = reply_src_addr;
++    recv_msghdr.msg_namelen = reply_src_addr_len;
++    recv_msghdr.msg_iov = &msg_iov;
++    recv_msghdr.msg_iovlen = 1;
++    recv_msghdr.msg_control = &msg_control;
++    recv_msghdr.msg_controllen = sizeof(msg_control);
+ #if HAVE_SO_TIMESTAMPNS
+     struct cmsghdr* cmsg;
+ #endif
diff --git a/meta-networking/recipes-support/fping/fping_5.1.bb b/meta-networking/recipes-support/fping/fping_5.1.bb
index f2dd897561..0682eafa09 100644
--- a/meta-networking/recipes-support/fping/fping_5.1.bb
+++ b/meta-networking/recipes-support/fping/fping_5.1.bb
@@ -14,7 +14,9 @@  LICENSE = "fping"
 NO_GENERIC_LICENSE[fping] = "COPYING"
 LIC_FILES_CHKSUM = "file://COPYING;md5=c6170fbadddfcd74f011515291d96901"
 
-SRC_URI = "http://www.fping.org/dist/fping-${PV}.tar.gz"
+SRC_URI = "http://www.fping.org/dist/fping-${PV}.tar.gz \
+           file://0001-fping-Initialize-msghdr-struct-in-a-portable-way.patch \
+           "
 SRC_URI[sha256sum] = "1ee5268c063d76646af2b4426052e7d81a42b657e6a77d8e7d3d2e60fd7409fe"
 
 S = "${WORKDIR}/fping-${PV}"