mcelog: Fix build with GCC14 and musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2024-05-11 23:37:23 -07:00
parent 61d407ad59
commit 03bcc8ffb2
2 changed files with 44 additions and 0 deletions
@@ -0,0 +1,43 @@
From 0370e7a9fb0ca1b27d7b0897739e2a7cce8977ab Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 11 May 2024 22:42:07 -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 *
Upstream-Status: Submitted [ sent to contact@mcelog.org ]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
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;
--
2.45.0
@@ -8,6 +8,7 @@ SECTION = "System Environment/Base"
SRC_URI = "\
git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git;protocol=http;;branch=master \
file://0001-client-Include-string.h-form-mem-function-prototypes.patch \
file://0001-server-Correct-prameter-type-for-connect-API.patch \
file://run-ptest \
"