Skip to content

Commit 4f970a6

Browse files
Bug#32525651: MYSQL_MIGRATE_KEYRING OPTION-HANDLING ISSUES
Description: When mysql_migrate_keyring is executed with --help option, it should not check validity of parameters which are mandatory for migration. RB: 26004
1 parent 627deed commit 4f970a6

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

client/migrate_keyring/migrate_keyring.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int main(int argc, char **argv) {
7979

8080
int exit_code;
8181
if (process_options(&argc, &argv, exit_code) == false) {
82-
return exit_status;
82+
return exit_code;
8383
}
8484

8585
{
@@ -136,5 +136,5 @@ int main(int argc, char **argv) {
136136
}
137137
log_info << "Key migration successful." << std::endl;
138138
}
139-
return 0;
139+
return EXIT_SUCCESS;
140140
}

client/migrate_keyring/options.cc

+8
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ enum migration_options {
7070
OPT_LAST
7171
};
7272

73+
bool Options::s_help = false;
7374
bool Options::s_verbose = false;
7475
char *Options::s_component_dir = nullptr;
7576
char *Options::s_source_keyring = nullptr;
@@ -173,11 +174,13 @@ static void usage(bool version_only) {
173174
bool get_one_option(int optid, const struct my_option *opt, char *argument) {
174175
switch (optid) {
175176
case 'V':
177+
Options::s_help = true;
176178
usage(true);
177179
break;
178180
case 'I':
179181
// Fall through
180182
case '?':
183+
Options::s_help = true;
181184
usage(false);
182185
break;
183186
case 'v':
@@ -229,6 +232,11 @@ static bool get_options(int argc, char **argv, int &exit_code) {
229232
return false;
230233
}
231234

235+
if (Options::s_help == true) {
236+
exit_code = EXIT_SUCCESS;
237+
return false;
238+
}
239+
232240
if (check_options_for_sanity() == false) return false;
233241

234242
if (Options::s_tty_password) Options::s_password = get_tty_password(NullS);

client/migrate_keyring/options.h

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ namespace options {
3535

3636
class Options {
3737
public:
38+
/** Help */
39+
static bool s_help;
3840
/** Be loud */
3941
static bool s_verbose;
4042
/** Component directory location */

0 commit comments

Comments
 (0)