Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From f645128082117a0152a95b3dccd869a184b7513f Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 10 Aug 2022 01:23:48 -0700 |
| 4 | Subject: [PATCH 1/2] Use posix strerror_r with musl |
| 5 | |
| 6 | Default with glibc is GNU extention of strerror_r |
| 7 | where as musl uses posix variant, call that out |
| 8 | |
| 9 | Upstream-Status: Inappropriate [Need wider porting beyond linux/musl/glibc] |
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 11 | --- |
| 12 | src/flb_network.c | 5 +++++ |
| 13 | 1 file changed, 5 insertions(+) |
| 14 | |
| 15 | diff --git a/src/flb_network.c b/src/flb_network.c |
| 16 | index 992eb1d..5d7a337 100644 |
| 17 | --- a/src/flb_network.c |
| 18 | +++ b/src/flb_network.c |
| 19 | @@ -506,7 +506,12 @@ static int net_connect_async(int fd, |
| 20 | } |
| 21 | |
| 22 | /* Connection is broken, not much to do here */ |
| 23 | +#ifdef __GLIBC__ |
| 24 | str = strerror_r(error, so_error_buf, sizeof(so_error_buf)); |
| 25 | +#else |
| 26 | + strerror_r(error, so_error_buf, sizeof(so_error_buf)); |
| 27 | + str = so_error_buf; |
| 28 | +#endif |
| 29 | flb_error("[net] TCP connection failed: %s:%i (%s)", |
| 30 | u->tcp_host, u->tcp_port, str); |
| 31 | return -1; |
| 32 | -- |
| 33 | 2.37.1 |
| 34 | |