diff mbox series

[meta-oe,18/63] lxdm: Fix msghdr initialization on musl

Message ID 20220904073417.3251865-18-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,01/63] libutempter: Upgrade to 1.2.2-alt1 | expand

Commit Message

Khem Raj Sept. 4, 2022, 7:33 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...lize-msghdr-struct-in-a-portable-way.patch | 40 +++++++++++++++++++
 meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb   |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta-oe/recipes-graphics/lxdm/lxdm/0001-Initialize-msghdr-struct-in-a-portable-way.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-graphics/lxdm/lxdm/0001-Initialize-msghdr-struct-in-a-portable-way.patch b/meta-oe/recipes-graphics/lxdm/lxdm/0001-Initialize-msghdr-struct-in-a-portable-way.patch
new file mode 100644
index 0000000000..d4779505d8
--- /dev/null
+++ b/meta-oe/recipes-graphics/lxdm/lxdm/0001-Initialize-msghdr-struct-in-a-portable-way.patch
@@ -0,0 +1,40 @@ 
+From 7c370576b4fb7c7d3b6dbf33125136a4ae70a330 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 31 Aug 2022 21:52:16 -0700
+Subject: [PATCH] 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://sourceforge.net/p/lxdm/code/merge-requests/4/]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/lxcom.c       | 9 +++++++--
+ 2 files changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/src/lxcom.c b/src/lxcom.c
+index 397d1b5..517c775 100644
+--- a/src/lxcom.c
++++ b/src/lxcom.c
+@@ -117,10 +117,15 @@ static gboolean lxcom_dispatch (GSource *source,GSourceFunc callback,gpointer us
+ 	char ctrl[/*CMSG_SPACE(sizeof(LXDM_CRED))*/1024];
+ 	struct sockaddr_un peer;
+ 	struct iovec v={buf,sizeof(buf)};
+-	struct msghdr h={&peer,sizeof(peer),&v,1,ctrl,sizeof(ctrl),0};
++	struct msghdr h={0};
+ 	struct cmsghdr *cmptr;
+ 	int ret;
+-
++	h.msg_name = &peer;
++	h.msg_namelen = sizeof(peer);
++	h.msg_iov = &v;
++	h.msg_iovlen = 1;
++	h.msg_control = ctrl;
++	h.msg_controllen = sizeof(ctrl);
+ 	while(1)
+ 	{
+ 		peer.sun_family=0;
+-- 
+2.37.3
+
diff --git a/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb b/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb
index 83b15ce8e5..adf9cb597c 100644
--- a/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb
+++ b/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb
@@ -19,6 +19,7 @@  SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}%20${PV}/${BPN}-${PV}.tar.
            file://0008-greeter.c-show-information-on-gtk-label-info.patch \
            file://0009-greeter.c-disallow-empty-new-password.patch \
            file://0001-systemd-lxdm.service-remove-plymouth-quit-conflicts.patch \
+           file://0001-Initialize-msghdr-struct-in-a-portable-way.patch \
            "
 SRC_URI[md5sum] = "061caae432634e6db38bbdc84bc6ffa0"
 SRC_URI[sha256sum] = "4891efee81c72a400cc6703e40aa76f3f3853833d048b72ec805da0f93567f2f"