File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 4949#include <monkey/mk_core.h>
5050#include <ares.h>
5151
52+ #ifdef FLB_SYSTEM_MACOS
53+ #ifdef _GNU_SOURCE
54+ #undef _GNU_SOURCE
55+ #endif
56+ /* Use POSIX version of strerror_r forcibly on macOS. */
57+ #include <string.h>
58+ #endif
59+
5260#ifndef SOL_TCP
5361#define SOL_TCP IPPROTO_TCP
5462#endif
@@ -524,7 +532,20 @@ static int net_connect_async(int fd,
524532 }
525533
526534 /* Connection is broken, not much to do here */
535+ #if ((defined(_POSIX_C_SOURCE ) && _POSIX_C_SOURCE >= 200112L ) || \
536+ (defined(_XOPEN_SOURCE ) || _XOPEN_SOURCE - 0L >= 600L )) && \
537+ (!defined(_GNU_SOURCE ))
538+ ret = strerror_r (error , so_error_buf , sizeof (so_error_buf ));
539+ if (ret == 0 ) {
540+ str = so_error_buf ;
541+ }
542+ else {
543+ flb_errno ();
544+ return -1 ;
545+ }
546+ #else
527547 str = strerror_r (error , so_error_buf , sizeof (so_error_buf ));
548+ #endif
528549 flb_error ("[net] TCP connection failed: %s:%i (%s)" ,
529550 u -> tcp_host , u -> tcp_port , str );
530551 return -1 ;
You can’t perform that action at this time.
0 commit comments