From: Martin Jansa <[email protected]>

Fixes:
libwebsockets/4.5.2/sources/libwebsockets-4.5.2/lib/plat/unix/unix-caps.c:54:8: 
error: initializing 'char *' with an expression of type 'const char *' discards 
qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
   54 |         char *colon = strchr(u_colon_g, ':'), u[33];
      |               ^       ~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: Martin Jansa <[email protected]>
---
 ...zation-discards-const-qualifier-from.patch | 111 ++++++++++++++++++
 .../libwebsockets/libwebsockets_4.5.2.bb      |   4 +-
 2 files changed, 114 insertions(+), 1 deletion(-)
 create mode 100644 
meta-oe/recipes-connectivity/libwebsockets/libwebsockets/0001-c23-fix-initialization-discards-const-qualifier-from.patch

diff --git 
a/meta-oe/recipes-connectivity/libwebsockets/libwebsockets/0001-c23-fix-initialization-discards-const-qualifier-from.patch
 
b/meta-oe/recipes-connectivity/libwebsockets/libwebsockets/0001-c23-fix-initialization-discards-const-qualifier-from.patch
new file mode 100644
index 0000000000..a61131ec2e
--- /dev/null
+++ 
b/meta-oe/recipes-connectivity/libwebsockets/libwebsockets/0001-c23-fix-initialization-discards-const-qualifier-from.patch
@@ -0,0 +1,111 @@
+From 8445ebac12f5863282b3a5fa31d6a7a085ec2d97 Mon Sep 17 00:00:00 2001
+From: Rudi Heitbaum <[email protected]>
+Date: Mon, 26 Jan 2026 02:13:40 +0000
+Subject: [PATCH] c23: fix initialization discards const qualifier from pointer
+ target type
+
+Since glibc-2.43:
+
+For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
+strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
+pointers into their input arrays now have definitions as macros that
+return a pointer to a const-qualified type when the input argument is
+a pointer to a const-qualified type.
+
+https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html
+
+Signed-off-by: Rudi Heitbaum <[email protected]>
+Signed-off-by: Martin Jansa <[email protected]>
+Upstream-Status: Backport 
[https://github.com/warmcat/libwebsockets/commit/54e67208976494a4a2235f2e0fc959d46bcb7452]
+---
+
+ lib/core-net/client/client.c   | 11 ++++++-----
+ lib/plat/unix/unix-caps.c      |  3 ++-
+ lib/roles/http/cookie.c        |  3 ++-
+ lib/roles/http/server/server.c |  3 ++-
+ 4 files changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/lib/core-net/client/client.c b/lib/core-net/client/client.c
+index e3bc6d590..2a3b69ec8 100644
+--- a/lib/core-net/client/client.c
++++ b/lib/core-net/client/client.c
+@@ -31,7 +31,7 @@ lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
+ {
+       char authstring[96];
+       int brackets = 0;
+-      char *p;
++      const char *p;
+ 
+       if (!proxy)
+               return -1;
+@@ -84,15 +84,17 @@ lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
+ 
+ #if defined(LWS_WITH_IPV6)
+       if (brackets) {
++              char *ncp;
++
+               /* original is IPv6 format "[::1]:443" */
+ 
+-              p = strchr(vhost->http.http_proxy_address, ']');
+-              if (!p) {
++              ncp = strchr(vhost->http.http_proxy_address, ']');
++              if (!ncp) {
+                       lwsl_vhost_err(vhost, "malformed proxy '%s'", proxy);
+ 
+                       return -1;
+               }
+-              *p++ = '\0';
++              *ncp++ = '\0';
+       }
+ #endif
+ 
+@@ -103,7 +105,6 @@ lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
+               return -1;
+       }
+       if (p) {
+-              *p = '\0';
+               vhost->http.http_proxy_port = (unsigned int)atoi(p + 1);
+       }
+ 
+diff --git a/lib/plat/unix/unix-caps.c b/lib/plat/unix/unix-caps.c
+index 2f38854d5..0897a5e6d 100644
+--- a/lib/plat/unix/unix-caps.c
++++ b/lib/plat/unix/unix-caps.c
+@@ -51,7 +51,8 @@ _lws_plat_apply_caps(unsigned int mode, const cap_value_t 
*cv, int count)
+ int
+ lws_plat_user_colon_group_to_ids(const char *u_colon_g, uid_t *puid, gid_t 
*pgid)
+ {
+-      char *colon = strchr(u_colon_g, ':'), u[33];
++      const char *colon = strchr(u_colon_g, ':');
++      char u[33];
+       struct group *g;
+       struct passwd *p;
+       size_t ulen;
+diff --git a/lib/roles/http/cookie.c b/lib/roles/http/cookie.c
+index 44ad6eb9b..1347f6f38 100644
+--- a/lib/roles/http/cookie.c
++++ b/lib/roles/http/cookie.c
+@@ -286,7 +286,8 @@ lws_cookie_write_nsc(struct lws *wsi, struct lws_cookie *c)
+       const char *ads, *path;
+       struct lws_cache_ttl_lru *l1;
+       struct client_info_stash *stash;
+-      char *cookie_string = NULL, *dl;
++      char *cookie_string = NULL;
++      const char *dl;
+        /* 6 tabs + 20 for max time_t + 2 * TRUE/FALSE + null */
+       size_t size = 6 + 20 + 10 + 1;
+       time_t expires = 0;
+diff --git a/lib/roles/http/server/server.c b/lib/roles/http/server/server.c
+index 69e13f075..d0e6f44ab 100644
+--- a/lib/roles/http/server/server.c
++++ b/lib/roles/http/server/server.c
+@@ -2378,7 +2378,8 @@ raw_transition:
+               if (wsi->a.context->reject_service_keywords) {
+                       const struct lws_protocol_vhost_options *rej =
+                                       wsi->a.context->reject_service_keywords;
+-                      char ua[384], *msg = NULL;
++                      char ua[384];
++                      const char *msg = NULL;
+ 
+                       if (lws_hdr_copy(wsi, ua, sizeof(ua) - 1,
+                                        WSI_TOKEN_HTTP_USER_AGENT) > 0) {
diff --git a/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb 
b/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb
index 35545aacee..983c2a4d87 100644
--- a/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb
+++ b/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb
@@ -7,7 +7,9 @@ DEPENDS = "zlib"
 DEPENDS:append:class-native = " libcap-native"
 
 SRCREV = "85c6f7959fd40d8aaf7a50be3c9b75f08389a01c"
-SRC_URI = 
"git://github.com/warmcat/libwebsockets.git;protocol=https;branch=v4.5-stable;tag=v${PV}"
+SRC_URI = 
"git://github.com/warmcat/libwebsockets.git;protocol=https;branch=v4.5-stable;tag=v${PV}
 \
+    file://0001-c23-fix-initialization-discards-const-qualifier-from.patch \
+"
 
 UPSTREAM_CHECK_URI = "https://github.com/warmcat/${BPN}/releases";
 UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#124902): 
https://lists.openembedded.org/g/openembedded-devel/message/124902
Mute This Topic: https://lists.openembedded.org/mt/118168282/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to