summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mysql-netdevname.patch59
-rw-r--r--mysql-va-list.patch55
2 files changed, 114 insertions, 0 deletions
diff --git a/mysql-netdevname.patch b/mysql-netdevname.patch
new file mode 100644
index 0000000..af17f13
--- /dev/null
+++ b/mysql-netdevname.patch
@@ -0,0 +1,59 @@
+diff -up mysql-5.5.15/mysys/my_gethwaddr.c.netdevname mysql-5.5.15/mysys/my_gethwaddr.c
+--- mysql-5.5.15/mysys/my_gethwaddr.c.netdevname 2011-07-13 21:09:02.000000000 +0200
++++ mysql-5.5.15/mysys/my_gethwaddr.c 2011-11-01 12:32:35.356119715 +0100
+@@ -68,28 +68,47 @@ err:
+ #include <sys/ioctl.h>
+ #include <net/ethernet.h>
+
++#define MAX_IFS 64
++
+ my_bool my_gethwaddr(uchar *to)
+ {
+ int fd, res= 1;
+ struct ifreq ifr;
+ char zero_array[ETHER_ADDR_LEN] = {0};
++ struct ifconf ifc;
++ struct ifreq ifs[MAX_IFS], *ifri, *ifend;
+
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (fd < 0)
+ goto err;
+
+- bzero(&ifr, sizeof(ifr));
+- strnmov(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name) - 1);
++ ifc.ifc_len = sizeof(ifs);
++ ifc.ifc_req = ifs;
++ if (ioctl(fd, SIOCGIFCONF, &ifc) < 0)
++ {
++ close(fd);
++ goto err;
++ }
++
++ memcpy(to, zero_array, ETHER_ADDR_LEN);
+
+- do
++ ifend = ifs + (ifc.ifc_len / sizeof(struct ifreq));
++ for (ifri = ifc.ifc_req; ifri < ifend; ifri++)
+ {
+- if (ioctl(fd, SIOCGIFHWADDR, &ifr) >= 0)
++ if (ifri->ifr_addr.sa_family == AF_INET)
+ {
+- memcpy(to, &ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
+- res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1;
++ bzero(&ifr, sizeof(ifr));
++ strncpy(ifr.ifr_name, ifri->ifr_name, sizeof(ifr.ifr_name));
++
++ /* Get HW address */
++ if (ioctl(fd, SIOCGIFHWADDR, &ifr) >= 0)
++ {
++ memcpy(to, &ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
++ if (!(res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1))
++ break;
++ }
+ }
+- } while (res && (errno == 0 || errno == ENODEV) && ifr.ifr_name[3]++ < '6');
+-
++ }
+ close(fd);
+ err:
+ return res;
diff --git a/mysql-va-list.patch b/mysql-va-list.patch
new file mode 100644
index 0000000..a76d0eb
--- /dev/null
+++ b/mysql-va-list.patch
@@ -0,0 +1,55 @@
+Fix unportable usage associated with va_list arguments. Passing "0" to
+a va_list argument only works if va_list is an integer or pointer type,
+which is not required by the C spec, and is not true on ARM for instance.
+Per bug #744707.
+
+
+diff -Naur mysql-5.5.16.orig/sql-common/client_plugin.c mysql-5.5.16/sql-common/client_plugin.c
+--- mysql-5.5.16.orig/sql-common/client_plugin.c 2011-09-09 11:56:39.000000000 -0400
++++ mysql-5.5.16/sql-common/client_plugin.c 2011-10-16 23:00:00.708799138 -0400
+@@ -228,11 +228,13 @@
+ {
+ MYSQL mysql;
+ struct st_mysql_client_plugin **builtin;
++ va_list unused;
+
+ if (initialized)
+ return 0;
+
+ bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
++ bzero(&unused, sizeof(unused)); /* suppress uninitialized-value warnings */
+
+ pthread_mutex_init(&LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
+ init_alloc_root(&mem_root, 128, 128);
+@@ -244,7 +246,7 @@
+ pthread_mutex_lock(&LOCK_load_client_plugin);
+
+ for (builtin= mysql_client_builtins; *builtin; builtin++)
+- add_plugin(&mysql, *builtin, 0, 0, 0);
++ add_plugin(&mysql, *builtin, 0, 0, unused);
+
+ pthread_mutex_unlock(&LOCK_load_client_plugin);
+
+@@ -288,9 +290,13 @@
+ mysql_client_register_plugin(MYSQL *mysql,
+ struct st_mysql_client_plugin *plugin)
+ {
++ va_list unused;
++
+ if (is_not_initialized(mysql, plugin->name))
+ return NULL;
+
++ bzero(&unused, sizeof(unused)); /* suppress uninitialized-value warnings */
++
+ pthread_mutex_lock(&LOCK_load_client_plugin);
+
+ /* make sure the plugin wasn't loaded meanwhile */
+@@ -302,7 +308,7 @@
+ plugin= NULL;
+ }
+ else
+- plugin= add_plugin(mysql, plugin, 0, 0, 0);
++ plugin= add_plugin(mysql, plugin, 0, 0, unused);
+
+ pthread_mutex_unlock(&LOCK_load_client_plugin);
+ return plugin;