Commit 8de323f8 authored by Etienne Guesnet's avatar Etienne Guesnet Committed by Daniel Black

MDEV-24099: sql/sql_insert ip_len issue on AIX

ip_len has a different meaning on AIX so we use a
different variable name here not to conflict.

Backport from MDEV-20178 2f5d3724
parent 71806bf3
...@@ -2690,7 +2690,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, ...@@ -2690,7 +2690,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
delayed_row *row= 0; delayed_row *row= 0;
Delayed_insert *di=thd->di; Delayed_insert *di=thd->di;
const Discrete_interval *forced_auto_inc; const Discrete_interval *forced_auto_inc;
size_t user_len, host_len, ip_len; size_t user_len, host_len, ip_length;
DBUG_ENTER("write_delayed"); DBUG_ENTER("write_delayed");
DBUG_PRINT("enter", ("query = '%s' length %lu", query.str, DBUG_PRINT("enter", ("query = '%s' length %lu", query.str,
(ulong) query.length)); (ulong) query.length));
...@@ -2724,7 +2724,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, ...@@ -2724,7 +2724,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
goto err; goto err;
} }
user_len= host_len= ip_len= 0; user_len= host_len= ip_length= 0;
row->user= row->host= row->ip= NULL; row->user= row->host= row->ip= NULL;
if (thd->security_ctx) if (thd->security_ctx)
{ {
...@@ -2733,11 +2733,11 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, ...@@ -2733,11 +2733,11 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
if (thd->security_ctx->host) if (thd->security_ctx->host)
host_len= strlen(thd->security_ctx->host) + 1; host_len= strlen(thd->security_ctx->host) + 1;
if (thd->security_ctx->ip) if (thd->security_ctx->ip)
ip_len= strlen(thd->security_ctx->ip) + 1; ip_length= strlen(thd->security_ctx->ip) + 1;
} }
/* This can't be THREAD_SPECIFIC as it's freed in delayed thread */ /* This can't be THREAD_SPECIFIC as it's freed in delayed thread */
if (!(row->record= (char*) my_malloc(table->s->reclength + if (!(row->record= (char*) my_malloc(table->s->reclength +
user_len + host_len + ip_len, user_len + host_len + ip_length,
MYF(MY_WME)))) MYF(MY_WME))))
goto err; goto err;
memcpy(row->record, table->record[0], table->s->reclength); memcpy(row->record, table->record[0], table->s->reclength);
...@@ -2757,7 +2757,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, ...@@ -2757,7 +2757,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
if (thd->security_ctx->ip) if (thd->security_ctx->ip)
{ {
row->ip= row->record + table->s->reclength + user_len + host_len; row->ip= row->record + table->s->reclength + user_len + host_len;
memcpy(row->ip, thd->security_ctx->ip, ip_len); memcpy(row->ip, thd->security_ctx->ip, ip_length);
} }
} }
row->query_id= thd->query_id; row->query_id= thd->query_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment