diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2018-05-11 14:20:22 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2018-05-11 17:36:14 +0400 |
commit | 569e3ad1ead6469fa9019a399dcef8d4f2fb71b4 (patch) | |
tree | 22e7d6d19d850b51a9fececb8b6034afdf4a0de2 | |
parent | 08098366d2f115037f0d844d59152b46e3ab19d8 (diff) | |
download | mariadb-git-569e3ad1ead6469fa9019a399dcef8d4f2fb71b4.tar.gz |
MDEV-15655: Add Linux abstract socket support
Less ifdefs, disable main.connect-abstract until libmariadb is updated.
-rw-r--r-- | mysql-test/main/disabled.def | 1 | ||||
-rw-r--r-- | sql/mysqld.cc | 15 |
2 files changed, 9 insertions, 7 deletions
diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def index b489139a59f..e83ff00d10b 100644 --- a/mysql-test/main/disabled.def +++ b/mysql-test/main/disabled.def @@ -21,3 +21,4 @@ innodb-wl5522-debug-zip : broken upstream innodb_bug12902967 : broken upstream file_contents : MDEV-6526 these files are not installed anymore max_statement_time : cannot possibly work, depends on timing +connect-abstract : waiting for libmariadb update diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 716bd472934..4309748fe06 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2787,7 +2787,7 @@ static void network_init(void) size_t port_len; DBUG_PRINT("general",("UNIX Socket is %s",mysqld_unix_port)); - if ((port_len=strlen(mysqld_unix_port)) > (sizeof(UNIXaddr.sun_path) - 1)) + if ((port_len= strlen(mysqld_unix_port)) > sizeof(UNIXaddr.sun_path) - 1) { sql_print_error("The socket file path is too long (> %u): %s", (uint) sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port); @@ -2808,22 +2808,23 @@ static void network_init(void) #if defined(__linux__) /* Abstract socket */ if (mysqld_unix_port[0] == '@') + { UNIXaddr.sun_path[0]= '\0'; + port_len+= offsetof(struct sockaddr_un, sun_path); + } else #endif + { (void) unlink(mysqld_unix_port); + port_len= sizeof(UNIXaddr); + } arg= 1; (void) mysql_socket_setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR, (char*)&arg, sizeof(arg)); umask(0); if (mysql_socket_bind(unix_sock, reinterpret_cast<struct sockaddr *>(&UNIXaddr), -#if defined(__linux__) - offsetof(struct sockaddr_un, sun_path) + port_len -#else - sizeof(UNIXaddr) -#endif - ) < 0) + port_len) < 0) { sql_perror("Can't start server : Bind on unix socket"); /* purecov: tested */ sql_print_error("Do you already have another mysqld server running on socket: %s ?",mysqld_unix_port); |