diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2017-12-18 17:15:48 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2017-12-19 19:10:54 +0400 |
commit | 2cd316911309e3db4007aa224f7874bfbeb14032 (patch) | |
tree | 53ffd4ab4d99f7ff37dfa31407c2199a222baf5c /client | |
parent | ed7e4b68ed59fb7c34dc06625dfe378e71d1e8a7 (diff) | |
download | mariadb-git-2cd316911309e3db4007aa224f7874bfbeb14032.tar.gz |
MDEV-14265 - RPMLint warning: shared-lib-calls-exit
find_type_or_exit() client helper did exit(1) on error, exit(1) moved to
clients.
mysql_read_default_options() did exit(1) on error, error is passed through and
handled now.
my_str_malloc_default() did exit(1) on error, replaced my_str_ allocator
functions with normal my_malloc()/my_realloc()/my_free().
sql_connect.cc did many exit(1) on hash initialisation failure. Removed error
check since my_hash_init() never fails.
my_malloc() did exit(1) on error. Replaced with abort().
my_load_defaults() did exit(1) on error, replaced with return 2.
my_load_defaults() still does exit(0) when invoked with --print-defaults.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 8 | ||||
-rw-r--r-- | client/mysqladmin.cc | 8 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 19 | ||||
-rw-r--r-- | client/mysqlcheck.c | 8 | ||||
-rw-r--r-- | client/mysqldump.c | 8 | ||||
-rw-r--r-- | client/mysqlimport.c | 8 | ||||
-rw-r--r-- | client/mysqlshow.c | 8 | ||||
-rw-r--r-- | client/mysqlslap.c | 8 | ||||
-rw-r--r-- | client/mysqltest.cc | 8 |
9 files changed, 63 insertions, 20 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index c043d054ea5..977085ebd42 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1793,8 +1793,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case OPT_MYSQL_PROTOCOL: #ifndef EMBEDDED_LIBRARY - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } #endif break; case OPT_SERVER_ARG: diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index ffdc73f99ad..897c2eb41c3 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -298,8 +298,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; } return 0; diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index c103061bbc5..b871a70ef01 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1649,8 +1649,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), remote_opt= 1; break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case OPT_START_DATETIME: start_datetime= convert_str_to_timestamp(start_datetime_str); @@ -1663,8 +1667,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_base64_output_mode= BASE64_OUTPUT_ALWAYS; else { - opt_base64_output_mode= (enum_base64_output_mode) - (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1); + int val; + + if ((val= find_type_with_warning(argument, &base64_output_mode_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } + opt_base64_output_mode= (enum_base64_output_mode) (val - 1); } break; case OPT_REWRITE_DB: // db_from->db_to diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index c4ac58973f8..47cb38751eb 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -367,8 +367,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), print_version(); exit(0); break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; } diff --git a/client/mysqldump.c b/client/mysqldump.c index aead4caf506..5c0ec2a5510 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -956,8 +956,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; } case (int) OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; } return 0; diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 7f03cb355f8..9c84d4a62a6 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -249,8 +249,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; #endif case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case '#': DBUG_PUSH(argument ? argument : "d:t:o"); diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 6f434d6770d..f851c15106e 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -328,8 +328,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case '#': DBUG_PUSH(argument ? argument : "d:t:o"); diff --git a/client/mysqlslap.c b/client/mysqlslap.c index a78bf35d51b..6a0b214305c 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -779,8 +779,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case '#': DBUG_PUSH(argument ? argument : default_dbug_option); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 155d0c4c092..2200462b2fe 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7292,8 +7292,12 @@ get_one_option(int optid, const struct my_option *opt, char *argument) exit(0); case OPT_MYSQL_PROTOCOL: #ifndef EMBEDDED_LIBRARY - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } #endif break; case '?': |