Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 1 | From 73b1002eda17451db1f58431b42c25203f1d3097 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 9 Sep 2018 17:38:10 -0700 |
| 4 | Subject: [PATCH] connect has a different signature on musl |
| 5 | |
| 6 | On linux when not using glibc and using musl for C library, connect |
| 7 | API has a different signature, this patch fixes this so it can compile |
| 8 | on musl, the functionality should remain same as it is immediately |
| 9 | typcasted to struct sockaddr_in* type inside the function before use |
| 10 | |
| 11 | Upstream-Status: Pending |
| 12 | |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 15 | validate/plugins/fault_injection/socket_interposer.c | 7 ++++++- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | 1 file changed, 6 insertions(+), 1 deletion(-) |
| 17 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 18 | diff --git a/validate/plugins/fault_injection/socket_interposer.c b/validate/plugins/fault_injection/socket_interposer.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 19 | index 53c1ebb..ad7adf8 100644 |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 20 | --- a/validate/plugins/fault_injection/socket_interposer.c |
| 21 | +++ b/validate/plugins/fault_injection/socket_interposer.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 22 | @@ -100,10 +100,15 @@ socket_interposer_set_callback (struct sockaddr_in *addrin, |
| 23 | } |
| 24 | |
| 25 | int |
| 26 | -connect (int socket, const struct sockaddr_in *addrin, socklen_t address_len) |
| 27 | +#if defined(__linux__) && !defined(__GLIBC__) |
| 28 | +connect (int socket, const struct sockaddr *addr, socklen_t address_len) |
| 29 | +#else |
| 30 | +connect (int socket, const struct sockaddr_in *addr, socklen_t address_len) |
| 31 | +#endif |
| 32 | { |
| 33 | size_t i; |
| 34 | int override_errno = 0; |
| 35 | + struct sockaddr_in* addrin = (struct sockaddr_in*)addr; |
| 36 | typedef ssize_t (*real_connect_fn) (int, const struct sockaddr_in *, |
| 37 | socklen_t); |
| 38 | static real_connect_fn real_connect = 0; |