mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-11-30 02:47:35 +08:00
Optimize more code hinted by coverity scan
This commit is contained in:
parent
1546298081
commit
78826aa070
@ -2057,7 +2057,7 @@ void admin_select_single_table(network_mysqld_con* con)
|
||||
}
|
||||
|
||||
void admin_sql_log_start(network_mysqld_con* con) {
|
||||
if (!con || !con->srv || !con->srv->sql_mgr) {
|
||||
if (!con->srv->sql_mgr) {
|
||||
network_mysqld_con_send_error(con->client, C("Unexpected error"));
|
||||
return;
|
||||
}
|
||||
@ -2079,7 +2079,7 @@ void admin_sql_log_start(network_mysqld_con* con) {
|
||||
}
|
||||
|
||||
void admin_sql_log_stop(network_mysqld_con* con) {
|
||||
if (!con || !con->srv || !con->srv->sql_mgr) {
|
||||
if (!con->srv->sql_mgr) {
|
||||
network_mysqld_con_send_error(con->client, C("Unexpected error"));
|
||||
return;
|
||||
}
|
||||
@ -2097,7 +2097,7 @@ void admin_sql_log_stop(network_mysqld_con* con) {
|
||||
}
|
||||
|
||||
void admin_sql_log_status(network_mysqld_con* con) {
|
||||
if (!con || !con->srv || !con->srv->sql_mgr) {
|
||||
if (!con->srv->sql_mgr) {
|
||||
network_mysqld_con_send_error(con->client, C("Unexpected error"));
|
||||
return;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ chassis_log_write(chassis_log *log, int log_level, GString *str)
|
||||
int log_fd = log->log_file_fd;
|
||||
|
||||
if (log_fd == -1) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = buffer;
|
||||
|
@ -432,7 +432,7 @@ log_sql_backend(network_mysqld_con *con, injection *inj)
|
||||
inj->id, inj->bytes, inj->rows,
|
||||
latency_ms, inj->qstat.query_status == MYSQLD_PACKET_OK ? "OK" : "ERR",
|
||||
GET_COM_NAME(con->parse.command),//type
|
||||
con->parse.command == 23 ? "" : (inj->query != NULL ? GET_COM_STRING(inj->query) : ""));//sql
|
||||
con->parse.command == COM_STMT_EXECUTE ? "" : (inj->query != NULL ? GET_COM_STRING(inj->query) : ""));//sql
|
||||
|
||||
rfifo_write(mgr->fifo, message->str, message->len);
|
||||
g_string_free(message, TRUE);
|
||||
|
@ -18,7 +18,8 @@
|
||||
|
||||
#define GET_COM_NAME(com_type) \
|
||||
((((gushort)com_type) <= 31) ? com_command_name[((gushort)com_type)].com_str : "UNKNOWN TYPE")
|
||||
#define GET_COM_STRING(query) GET_COM_NAME((query)->str[0]), ((query)->len > 1 ? ((query)->str + 1) : "")
|
||||
|
||||
#define GET_COM_STRING(query) ((query)->len > 1 ? ((query)->str + 1) : "")
|
||||
|
||||
typedef struct com_string {
|
||||
char *com_str;
|
||||
|
Loading…
Reference in New Issue
Block a user