summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-09-11 22:06:27 +0500
committerRamil Kalimullin <ramil@mysql.com>2009-09-11 22:06:27 +0500
commitb6c16b329a861b4b7da9cda2ede9921af912fd38 (patch)
tree98ac2229cd084bbe50f4f9944773a4e7d60200c8 /sql/log.cc
parent057192abbd261f453711a3296c48f091a702019a (diff)
downloadmariadb-git-b6c16b329a861b4b7da9cda2ede9921af912fd38.tar.gz
Fix for bug#47130: misplaced or redundant check for null pointer?
Problem: LOGGER::general_log_write() relied on valid "thd" parameter passed but had inconsistent "if (thd)" check. Fix: as we always pass a valid "thd" parameter to the method, redundant check removed. sql/log.cc: Fix for bug#47130: misplaced or redundant check for null pointer? - code clean-up, as we rely on the "thd" parameter in the LOGGER::general_log_write(), redundant "if (thd)" check removed, added assert(thd) instead.
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 1af2f3a4ddc..feaa5499912 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1024,14 +1024,10 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command,
Log_event_handler **current_handler= general_log_handler_list;
char user_host_buff[MAX_USER_HOST_SIZE + 1];
Security_context *sctx= thd->security_ctx;
- ulong id;
uint user_host_len= 0;
time_t current_time;
- if (thd)
- id= thd->thread_id; /* Normal thread */
- else
- id= 0; /* Log from connect handler */
+ DBUG_ASSERT(thd);
lock_shared();
if (!opt_log)
@@ -1050,7 +1046,7 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command,
while (*current_handler)
error|= (*current_handler++)->
log_general(thd, current_time, user_host_buff,
- user_host_len, id,
+ user_host_len, thd->thread_id,
command_name[(uint) command].str,
command_name[(uint) command].length,
query, query_length,