package/mcelog: fix musl build with gcc >= 14.x

Fixes:
https://autobuild.buildroot.net/results/902/9020e4fda8cbc4f9886d5e8725f6df8d99716241/

The build error does not occur with gcc-13.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Bernd Kuhls
2026-01-18 18:07:30 +01:00
committed by Julien Olivain
parent 21dda0665e
commit a042ea816a
2 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
From c17897deb52daab300c585a6a6c2456d062d80cf Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 11 May 2024 22:50:19 -0700
Subject: [PATCH] server: Correct prameter type for connect() API
connect() function expects the second argument to be point to sockaddr
as per man sockaddr
int connect (int, const struct sockaddr *, socklen_t);
Fixes build failures with -Wincompatible-pointer-types when using GCC-14
and musl
Fixes
| server.c: In function 'server_ping':
| server.c:308:33: error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
| 308 | if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
| | ^~
| | |
| | struct sockaddr_un *
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Upstream: https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git/commit/?id=c17897deb52daab300c585a6a6c2456d062d80cf
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server.c b/server.c
index 54c7d57..51b7d3a 100644
--- a/server.c
+++ b/server.c
@@ -305,7 +305,7 @@ static int server_ping(struct sockaddr_un *un)
if (sigsetjmp(ping_timeout_ctx, 1) == 0) {
ret = -1;
alarm(initial_ping_timeout);
- if (connect(fd, un, sizeof(struct sockaddr_un)) < 0)
+ if (connect(fd, (const struct sockaddr *)un, sizeof(struct sockaddr_un)) < 0)
goto cleanup;
if (write(fd, PAIR("ping\n")) < 0)
goto cleanup;

View File

@@ -0,0 +1,42 @@
From a90e39f896a2f1b76ad3c304b69c451ec92a687a Mon Sep 17 00:00:00 2001
From: Brahmajit Das <brahmajit.xyz@gmail.com>
Date: Mon, 12 Jun 2023 10:55:28 +0000
Subject: [PATCH] client.c: fix build w/ musl libc
Without the patch, I'm getting the following error:
client.c:47:2: error: call to undeclared library function 'strncpy' with type
'char *(char *, const char *, unsigned long)'; ISO C99 and later do not support implicit function declarations
[-Wimplicit-function-declaration]
strncpy(sun.sun_path, path, sizeof(sun.sun_path)-1);
^
client.c:47:2: note: include the header <string.h> or explicitly provide a declaration for 'strncpy'
client.c:60:19: error: call to undeclared library function 'memcmp' with type 'int
(const void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations
[-Wimplicit-function-declaration]
if (n >= 5 && !memcmp(buf + n - 5, "done\n", 5)) {
^
client.c:60:19: note: include the header <string.h> or explicitly provide a declaration for 'memcmp'
2 errors generated.
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Upstream: https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git/commit/?id=a90e39f896a2f1b76ad3c304b69c451ec92a687a
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
client.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/client.c b/client.c
index 883b1de..7119ed9 100644
--- a/client.c
+++ b/client.c
@@ -19,6 +19,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
+#include <string.h>
#include "mcelog.h"
#include "client.h"
#include "paths.h"