mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Review of all code pushed since last review
Simple optimzations and cleanups Removed compiler warnings and fixed portability issues Added client functions 'mysql_embedded()' to allow client to check if we are using embedded server Fixes for purify client/mysqlimport.c: Remove not used variable client/mysqltest.c: Remove usage of MAXPATHLEN (all MySQL code uses FN_REFLEN) Simplified code Remove usage of sprintf("%llu") as this is not portable include/mysql.h: Added mysql_embedded() to be able to easily check if we are using the embedded server innobase/srv/srv0start.c: Don't use memcmp() when using purify (to avoid false warnings) libmysql/libmysql.c: Added mysql_embedded() to be able to easily check if we are using the embedded server libmysql/libmysql.def: Added mysql_embedded() to be able to easily check if we are using the embedded server myisam/myisam_ftdump.c: Remove compiler warning myisam/myisamchk.c: Remove compiler warning myisam/rt_test.c: #ifdef not used code mysys/hash.c: Remove compiler warning (from last push) mysys/my_gethwaddr.c: Remove compiler warning ndb/src/ndbapi/ndberror.c: #ifdef not used code regex/regcomp.c: Remove not used code regex/regcomp.ih: Remove not used code (to remove compiler warnings) sql-common/client.c: Remove compiler warnings sql/field.cc: Simple optimization sql/ha_innodb.cc: Rename mysql_embedded -> mysqld_embedded sql/item.cc: Fix comments Move variables first on block Remove else after return Simple optimizations (no logic changes) sql/item_cmpfunc.cc: Added comment sql/mysql_priv.h: Rename mysql_embedded -> mysqld_embedded sql/mysqld.cc: Rename mysql_embedded -> mysqld_embedded sql/sql_acl.cc: Added comments simple optimization Fixed 'very unlikely' bug when doing REVOKE ALL PRIVILEGES sql/sql_select.cc: More comments Simple optimization sql/sql_show.cc: Simple changes to make similar code similar More comments sql/sql_string.cc: Trivial optimization and better code layout strings/Makefile.am: Change xml.c to use bcmp to avoid warnings from purify strings/xml.c: Change xml.c to use bcmp to avoid warnings from purify tests/client_test.c: Remove usage of MAXPATHLEN (all MySQL code uses FN_REFLEN)
This commit is contained in:
@ -2398,7 +2398,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
table_list->db,
|
||||
table_list->real_name,
|
||||
rights, column_priv, revoke_grant))
|
||||
{ // Crashend table ??
|
||||
{
|
||||
/* Should only happen if table is crashed */
|
||||
result= -1; /* purecov: deadcode */
|
||||
}
|
||||
else if (tables[2].table)
|
||||
@ -3636,12 +3637,17 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
if (!strcmp(lex_user->user.str,user) &&
|
||||
!my_strcasecmp(system_charset_info, lex_user->host.str, host))
|
||||
{
|
||||
if (replace_db_table(tables[1].table, acl_db->db, *lex_user, ~0, 1))
|
||||
result= -1;
|
||||
else
|
||||
if (!replace_db_table(tables[1].table, acl_db->db, *lex_user, ~0, 1))
|
||||
{
|
||||
/*
|
||||
Don't increment counter as replace_db_table deleted the
|
||||
current element in acl_db's and shifted the higher elements down
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
result= -1; // Something went wrong
|
||||
}
|
||||
++counter;
|
||||
counter++;
|
||||
}
|
||||
|
||||
/* Remove column access */
|
||||
@ -3664,26 +3670,27 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
~0, 0, 1))
|
||||
{
|
||||
result= -1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (grant_table->cols)
|
||||
{
|
||||
List<LEX_COLUMN> columns;
|
||||
if (replace_column_table(grant_table,tables[3].table, *lex_user,
|
||||
columns,
|
||||
grant_table->db,
|
||||
grant_table->tname,
|
||||
~0, 1))
|
||||
result= -1;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
if (!grant_table->cols)
|
||||
continue;
|
||||
List<LEX_COLUMN> columns;
|
||||
if (replace_column_table(grant_table,tables[3].table, *lex_user,
|
||||
columns,
|
||||
grant_table->db,
|
||||
grant_table->tname,
|
||||
~0, 1))
|
||||
result= -1;
|
||||
/*
|
||||
Safer to do continue here as replace_table_table changed
|
||||
column_priv_hash and we want to test the current element
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
}
|
||||
++counter;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user