You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fix for OpenSSL: Since OpenSSL doesn't use setsockopt/MSG_NOSIGNAL we
need to install a sigpipe handler (in case the application didn't install one already)
This commit is contained in:
@@ -3472,6 +3472,13 @@ BOOL CALLBACK win_init_once(
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SIGPIPE) && !defined(_WIN32) && defined(WITH_OPENSSL)
|
||||
static void ma_sigpipe_handler()
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
int STDCALL mysql_server_init(int argc __attribute__((unused)),
|
||||
char **argv __attribute__((unused)),
|
||||
char **groups __attribute__((unused)))
|
||||
@@ -3482,6 +3489,17 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
|
||||
return ret? 0: 1;
|
||||
#else
|
||||
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||
#if defined(SIGPIPE) && defined(WITH_OPENSSL)
|
||||
struct sigaction old_handler, new_handler={NULL};
|
||||
if (!sigaction (SIGPIPE, NULL, &old_handler) &&
|
||||
!old_handler.sa_handler)
|
||||
{
|
||||
new_handler.sa_handler= ma_sigpipe_handler;
|
||||
new_handler.sa_flags= 0;
|
||||
if (!sigemptyset(&new_handler.sa_mask))
|
||||
sigaction(SIGPIPE, &new_handler, NULL);
|
||||
}
|
||||
#endif
|
||||
return pthread_once(&init_once, mysql_once_init);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user