diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-05-24 13:11:33 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-07-06 23:46:28 +0200 |
commit | 4d2131354914f54f85abf0bb8cb4bdd42d817f73 (patch) | |
tree | 726e57b7a1816f5d0d7b358c4a074734a4f202b4 /client | |
parent | 946a07e8a85c5553b3906b46052b8044cb70a480 (diff) | |
download | mariadb-git-4d2131354914f54f85abf0bb8cb4bdd42d817f73.tar.gz |
coverity medium warnings
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 5 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 2 | ||||
-rw-r--r-- | client/mysqldump.c | 5 | ||||
-rw-r--r-- | client/mysqlimport.c | 2 | ||||
-rw-r--r-- | client/mysqltest.cc | 10 |
5 files changed, 13 insertions, 11 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index faef4670b31..9b5a9fb8aaa 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -4803,10 +4803,11 @@ com_status(String *buffer __attribute__((unused)), tee_fprintf(stdout, "Protocol:\t\tCompressed\n"); #endif - if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0]) + const char *pos; + if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0] && + (pos= strchr(status_str,' '))) { ulong sec; - const char *pos= strchr(status_str,' '); /* print label */ tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str); if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec))) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 397a252cdc0..e131aabd8b6 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1083,6 +1083,8 @@ int main(int argc, char **argv) { int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL, "mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE)); + if (fd < 0) + die(NULL); my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE)); my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE)); my_close(fd, MYF(0)); diff --git a/client/mysqldump.c b/client/mysqldump.c index 6877a5cee3b..66a2b5f795c 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -92,8 +92,7 @@ static void add_load_option(DYNAMIC_STRING *str, const char *option, const char *option_value); -static ulong find_set(TYPELIB *lib, const char *x, size_t length, - char **err_pos, uint *err_len); +static ulong find_set(TYPELIB *, const char *, size_t, char **, uint *); static char *alloc_query_str(ulong size); static void field_escape(DYNAMIC_STRING* in, const char *from); @@ -5373,7 +5372,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length, var_len= (uint) (pos - start); strmake(buff, start, MY_MIN(sizeof(buff) - 1, var_len)); find= find_type(buff, lib, FIND_TYPE_BASIC); - if (!find) + if (find <= 0) { *err_pos= (char*) start; *err_len= var_len; diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 216359c82ec..7f03cb355f8 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -675,7 +675,7 @@ int main(int argc, char **argv) MYF(0)))) return -2; - for (counter= 0; *argv != NULL; argv++) /* Loop through tables */ + for (; *argv != NULL; argv++) /* Loop through tables */ { pthread_mutex_lock(&counter_mutex); while (counter == opt_use_threads) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index bfbbdb0bdfb..f1c50432e4d 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -600,7 +600,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query, void str_to_file(const char *fname, char *str, int size); void str_to_file2(const char *fname, char *str, int size, my_bool append); -void fix_win_paths(const char *val, int len); +void fix_win_paths(const char *val, size_t len); const char *get_errname_from_code (uint error_code); int multi_reg_replace(struct st_replace_regex* r,char* val); @@ -814,8 +814,7 @@ public: LogFile log_file; LogFile progress_file; -void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, - int len); +void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, size_t len); void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val); void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val); void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING* ds_input, @@ -2654,6 +2653,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end) if (!mysql) { struct st_command command; + DBUG_ASSERT(query_end); memset(&command, 0, sizeof(command)); command.query= (char*)query; command.first_word_len= (*query_end - query); @@ -7530,7 +7530,7 @@ void free_win_path_patterns() => all \ from c:\mysql\m... until next space is converted into / */ -void fix_win_paths(const char *val, int len) +void fix_win_paths(const char *val, size_t len) { uint i; char *p; @@ -11031,7 +11031,7 @@ void free_pointer_array(POINTER_ARRAY *pa) /* Append the string to ds, with optional replace */ void replace_dynstr_append_mem(DYNAMIC_STRING *ds, - const char *val, int len) + const char *val, size_t len) { char lower[512]; #ifdef __WIN__ |