]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
systemd: Fix build regression with latest update
authorKhem Raj <raj.khem@gmail.com>
Fri, 6 May 2022 03:33:40 +0000 (20:33 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 6 May 2022 21:31:58 +0000 (22:31 +0100)
This happens when ptest is enabled with clang compiler

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/systemd/systemd/0001-resolve-Use-sockaddr-pointer-type-for-bind.patch [new file with mode: 0644]
meta/recipes-core/systemd/systemd_250.5.bb

diff --git a/meta/recipes-core/systemd/systemd/0001-resolve-Use-sockaddr-pointer-type-for-bind.patch b/meta/recipes-core/systemd/systemd/0001-resolve-Use-sockaddr-pointer-type-for-bind.patch
new file mode 100644 (file)
index 0000000..8567283
--- /dev/null
@@ -0,0 +1,46 @@
+From ad1428f29196bcc88ae382ee67ff705928e2be24 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 5 May 2022 20:25:37 -0700
+Subject: [PATCH] resolve: Use sockaddr pointer type for bind()
+
+bind() expects sockaddr* but SERVER_ADDRESS is sockaddr_in type struct
+
+Fixes errors with clang e.g.
+
+../git/src/resolve/test-resolved-stream.c:112:32: error: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Werror,-Wincompatible-pointer-types]
+        assert_se(bind(bindfd, &SERVER_ADDRESS, sizeof(SERVER_ADDRESS)) >= 0);
+                               ^~~~~~~~~~~~~~~
+../git/src/resolve/test-resolved-stream.c:251:39: error: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Werror,-Wincompatible-pointer-types]
+                r = connect(clientfd, &SERVER_ADDRESS, sizeof(SERVER_ADDRESS));
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/23281]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/resolve/test-resolved-stream.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/resolve/test-resolved-stream.c b/src/resolve/test-resolved-stream.c
+index f12c729e50..504b532002 100644
+--- a/src/resolve/test-resolved-stream.c
++++ b/src/resolve/test-resolved-stream.c
+@@ -109,7 +109,7 @@ static void *tcp_dns_server(void *p) {
+         assert_se((bindfd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0)) >= 0);
+         assert_se(setsockopt(bindfd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) >= 0);
+-        assert_se(bind(bindfd, &SERVER_ADDRESS, sizeof(SERVER_ADDRESS)) >= 0);
++        assert_se(bind(bindfd, (struct sockaddr*)&SERVER_ADDRESS, sizeof(SERVER_ADDRESS)) >= 0);
+         assert_se(listen(bindfd, 1) >= 0);
+         assert_se((acceptfd = accept(bindfd, NULL, NULL)) >= 0);
+         server_handle(acceptfd);
+@@ -248,7 +248,7 @@ static void test_dns_stream(bool tls) {
+         assert_se((clientfd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0)) >= 0);
+         for (int i = 0; i < 100; i++) {
+-                r = connect(clientfd, &SERVER_ADDRESS, sizeof(SERVER_ADDRESS));
++                r = connect(clientfd, (struct sockaddr*)&SERVER_ADDRESS, sizeof(SERVER_ADDRESS));
+                 if (r >= 0)
+                         break;
+                 usleep(EVENT_TIMEOUT_USEC / 100);
+-- 
+2.36.0
+
index 2cf3b7ca889a69b7a9bc7fcbba3a5b8156eae546..e5a2f65202ccf5789c8c8055cd213f87dd39a073 100644 (file)
@@ -25,6 +25,7 @@ SRC_URI += "file://touchscreen.rules \
            file://0003-implment-systemd-sysv-install-for-OE.patch \
            file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
            file://0001-test-parse-argument-Include-signal.h.patch \
+           file://0001-resolve-Use-sockaddr-pointer-type-for-bind.patch \
            "
 
 # patches needed by musl