summaryrefslogtreecommitdiff
path: root/mysys/default.c
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@mysql.com>2008-10-27 13:57:59 +0400
committerAlexey Botchkov <holyfoot@mysql.com>2008-10-27 13:57:59 +0400
commitbe66e43dabe2681705a9adfe3d385496dc827882 (patch)
treeaa7b899c121b6572fb65f716fb71cddc27f7136c /mysys/default.c
parentb6704027d681a80be03d416e9c9c344d86a562dd (diff)
downloadmariadb-git-be66e43dabe2681705a9adfe3d385496dc827882.tar.gz
Bug#39289 libmysqld.a calls exit() upon error
Several functions (mostly in mysqld.cc) directly call exit() function in case of errors, which is not a desired behaviour expecially in the embedded-server library. Fixed by making these functions return error sign instead of exiting. per-file comments: include/my_getopt.h Bug#39289 libmysqld.a calls exit() upon error added 'error' retvalue for my_getopt_register_get_addr libmysqld/lib_sql.cc Bug#39289 libmysqld.a calls exit() upon error unireg_clear() function implemented mysys/default.c Bug#39289 libmysqld.a calls exit() upon error error returned instead of exit() call mysys/mf_tempdir.c Bug#39289 libmysqld.a calls exit() upon error free_tmpdir() - fixed so it's not produce crash on uninitialized tmpdir structure mysys/my_getopt.c Bug#39289 libmysqld.a calls exit() upon error error returned instead of exit() call sql/mysql_priv.h Bug#39289 libmysqld.a calls exit() upon error unireg_abort definition fixed for the embedded server sql/mysqld.cc Bug#39289 libmysqld.a calls exit() upon error various functions fixed error returned instead of exit() call
Diffstat (limited to 'mysys/default.c')
-rw-r--r--mysys/default.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mysys/default.c b/mysys/default.c
index 6b2b31d43ec..c7e1e513e1e 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -144,6 +144,7 @@ static char *remove_end_comment(char *ptr);
RETURN
0 ok
1 given cinf_file doesn't exist
+ 2 out of memory
The global variable 'my_defaults_group_suffix' is updated with value for
--defaults_group_suffix
@@ -190,7 +191,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
if (!(extra_groups=
(const char**)alloc_root(ctx->alloc,
(2*group->count+1)*sizeof(char*))))
- goto err;
+ DBUG_RETURN(2);
for (i= 0; i < group->count; i++)
{
@@ -199,7 +200,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
len= strlen(extra_groups[i]);
if (!(ptr= alloc_root(ctx->alloc, len+instance_len+1)))
- goto err;
+ DBUG_RETURN(2);
extra_groups[i+group->count]= ptr;
@@ -254,12 +255,11 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
}
}
- DBUG_RETURN(error);
+ DBUG_RETURN(0);
err:
fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
- exit(1);
- return 0; /* Keep compiler happy */
+ DBUG_RETURN(1);
}