blob: 21e30d6d464a5d7be25c21428f8fe8a57ef05c1f [file] [log] [blame]
From 0c73b8131efba63c5cd37ea8c7551434c3b57304 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 9 Sep 2018 17:38:10 -0700
Subject: [PATCH] connect has a different signature on musl
On linux when not using glibc and using musl for C library, connect
API has a different signature, this patch fixes this so it can compile
on musl, the functionality should remain same as it is immediately
typcasted to struct sockaddr_in* type inside the function before use
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
validate/plugins/fault_injection/socket_interposer.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/validate/plugins/fault_injection/socket_interposer.c b/validate/plugins/fault_injection/socket_interposer.c
index 53c1ebb..ad7adf8 100644
--- a/validate/plugins/fault_injection/socket_interposer.c
+++ b/validate/plugins/fault_injection/socket_interposer.c
@@ -100,10 +100,15 @@ socket_interposer_set_callback (struct sockaddr_in *addrin,
}
int
-connect (int socket, const struct sockaddr_in *addrin, socklen_t address_len)
+#if defined(__linux__) && !defined(__GLIBC__)
+connect (int socket, const struct sockaddr *addr, socklen_t address_len)
+#else
+connect (int socket, const struct sockaddr_in *addr, socklen_t address_len)
+#endif
{
size_t i;
int override_errno = 0;
+ struct sockaddr_in* addrin = (struct sockaddr_in*)addr;
typedef ssize_t (*real_connect_fn) (int, const struct sockaddr_in *,
socklen_t);
static real_connect_fn real_connect = 0;