summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-05-12 15:10:17 +0200
committerSergei Golubchik <serg@mariadb.org>2017-05-15 22:23:10 +0200
commit71b45032421fe47fceabe419c63e79c44794428d (patch)
treec771e726ce4140b0798e7588034704801509e1ff /sql
parentf9264280d68dcbca2f9312c7d8620b2bcc9d0694 (diff)
downloadmariadb-git-71b45032421fe47fceabe419c63e79c44794428d.tar.gz
MDEV-9998 Fix issues caught by Clang's -Wpointer-bool-conversion warning
remove useless checks and a couple of others
Diffstat (limited to 'sql')
-rw-r--r--sql/log.cc2
-rw-r--r--sql/log_event_old.cc6
-rw-r--r--sql/slave.cc5
-rw-r--r--sql/sql_acl.cc6
-rw-r--r--sql/sql_audit.cc3
5 files changed, 6 insertions, 16 deletions
diff --git a/sql/log.cc b/sql/log.cc
index e99eefe4970..b80d65e20db 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1294,7 +1294,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
/* fill in user_host value: the format is "%s[%s] @ %s [%s]" */
user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
- sctx->priv_user ? sctx->priv_user : "", "[",
+ sctx->priv_user, "[",
sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ",
sctx->host ? sctx->host : "", " [",
sctx->ip ? sctx->ip : "", "]", NullS) -
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 8bdb81f5283..73869e82f72 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1681,8 +1681,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
default:
rli->report(ERROR_LEVEL, thd->net.last_errno, NULL,
"Error in %s event: row application failed. %s",
- get_type_str(),
- thd->net.last_error ? thd->net.last_error : "");
+ get_type_str(), thd->net.last_error);
thd->is_slave_error= 1;
break;
}
@@ -1721,8 +1720,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
"Error in %s event: error during transaction execution "
"on table %s.%s. %s",
get_type_str(), table->s->db.str,
- table->s->table_name.str,
- thd->net.last_error ? thd->net.last_error : "");
+ table->s->table_name.str, thd->net.last_error);
/*
If one day we honour --skip-slave-errors in row-based replication, and
diff --git a/sql/slave.cc b/sql/slave.cc
index 8801e9e9ab5..3dd17fd7276 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -5647,8 +5647,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
TODO: handling `when' for SHOW SLAVE STATUS' snds behind
*/
- if ((memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len())
- && mi->master_log_name != NULL)
+ if (memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len())
|| mi->master_log_pos > hb.log_pos)
{
/* missed events of heartbeat from the past */
@@ -6153,7 +6152,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir_ptr);
/* we disallow empty users */
- if (mi->user == NULL || mi->user[0] == 0)
+ if (mi->user[0] == 0)
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
ER(ER_SLAVE_FATAL_ERROR),
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ac833e01ba7..c7e47c84db0 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -10639,12 +10639,6 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
/* global privileges */
grant->privilege= sctx->master_access;
- if (!sctx->priv_user)
- {
- DBUG_PRINT("info", ("privilege 0x%lx", grant->privilege));
- DBUG_VOID_RETURN; // it is slave
- }
-
if (!thd->db || strcmp(db, thd->db))
{
/* db privileges */
diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc
index b659054a50b..60a75cb06e7 100644
--- a/sql/sql_audit.cc
+++ b/sql/sql_audit.cc
@@ -369,8 +369,7 @@ int initialize_audit_plugin(st_plugin_int *plugin)
{
st_mysql_audit *data= (st_mysql_audit*) plugin->plugin->info;
- if (!data->class_mask || !data->event_notify ||
- !data->class_mask[0])
+ if (!data->event_notify || !data->class_mask[0])
{
sql_print_error("Plugin '%s' has invalid data.",
plugin->name.str);