fixes to make it compile and pass the test suite again after the last

accidental push of broken code.
parent 34998c5a
...@@ -253,10 +253,16 @@ int main(int argc,char *argv[]) ...@@ -253,10 +253,16 @@ int main(int argc,char *argv[])
int error, ho_error; int error, ho_error;
MYSQL mysql; MYSQL mysql;
char **commands; char **commands;
char** save_argv;
MY_INIT(argv[0]); MY_INIT(argv[0]);
mysql_init(&mysql); mysql_init(&mysql);
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
save_argv = argv;
/* Sasha: with the change to handle_options() we now need to do this fix
with save_argv in all client utilities. The problem is that
handle_options may modify argv, and that wreaks havoc with
free_defaults()
*/
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
{ {
printf("%s: handle_options() failed with error %d\n", my_progname, printf("%s: handle_options() failed with error %d\n", my_progname,
...@@ -327,7 +333,7 @@ int main(int argc,char *argv[]) ...@@ -327,7 +333,7 @@ int main(int argc,char *argv[])
} }
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
my_free(user,MYF(MY_ALLOW_ZERO_PTR)); my_free(user,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(argv); free_defaults(save_argv);
my_end(0); my_end(0);
exit(error ? 1 : 0); exit(error ? 1 : 0);
return 0; return 0;
......
...@@ -58,7 +58,8 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ ...@@ -58,7 +58,8 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
my_compress.lo array.lo my_once.lo list.lo my_net.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \
charset.lo hash.lo mf_iocache.lo \ charset.lo hash.lo mf_iocache.lo \
mf_iocache2.lo my_seek.lo \ mf_iocache2.lo my_seek.lo \
my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo \
my_getopt.lo
# Not needed in the minimum library # Not needed in the minimum library
mysysobjects2 = getopt.lo getopt1.lo getvar.lo my_lib.lo mysysobjects2 = getopt.lo getopt1.lo getvar.lo my_lib.lo
......
...@@ -102,6 +102,12 @@ int handle_options(int *argc, char ***argv, ...@@ -102,6 +102,12 @@ int handle_options(int *argc, char ***argv,
cur_arg= *pos; cur_arg= *pos;
(*argc)--; (*argc)--;
} }
/* Sasha: quick dirty fix of a bug that coredumps mysqladmin while
running the test suite. The bug is actually pretty serious -
even in cases when we do not coredump, -O var=val will not set
the variable, and the previous option would be treated upredictably.
*/
goto found_var;
} }
else if (*cur_arg == '-') /* check for long option, or --set-variable */ else if (*cur_arg == '-') /* check for long option, or --set-variable */
{ {
...@@ -145,6 +151,7 @@ int handle_options(int *argc, char ***argv, ...@@ -145,6 +151,7 @@ int handle_options(int *argc, char ***argv,
continue; continue;
} }
} }
found_var:
optend= strcend(cur_arg, '='); optend= strcend(cur_arg, '=');
length= optend - cur_arg; length= optend - cur_arg;
if (*optend == '=') if (*optend == '=')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment