Commit 2153aaf6 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

mariabackup : use die() macro for fatal exit with error message.

parent a8a27e65
...@@ -2221,7 +2221,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo ...@@ -2221,7 +2221,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
to, 1)); to, 1));
} }
if (!rc) if (!rc)
exit(EXIT_FAILURE); die("copy or move file failed");
} }
datadir_iter_free(it); datadir_iter_free(it);
datadir_node_free(&node); datadir_node_free(&node);
...@@ -2323,8 +2323,7 @@ static void rocksdb_backup_checkpoint() ...@@ -2323,8 +2323,7 @@ static void rocksdb_backup_checkpoint()
if (backup_to_directory) if (backup_to_directory)
{ {
if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){ if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){
msg("Can't create rocksdb backup directory %s", rocksdb_backup_dir); die("Can't create rocksdb backup directory %s", rocksdb_backup_dir);
exit(EXIT_FAILURE);
} }
} }
copy_or_move_dir(rocksdb_checkpoint_dir, ROCKSDB_BACKUP_DIR, true, backup_to_directory); copy_or_move_dir(rocksdb_checkpoint_dir, ROCKSDB_BACKUP_DIR, true, backup_to_directory);
......
...@@ -167,9 +167,10 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result, ...@@ -167,9 +167,10 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
MYSQL_RES *mysql_result = NULL; MYSQL_RES *mysql_result = NULL;
if (mysql_query(connection, query)) { if (mysql_query(connection, query)) {
msg("Error: failed to execute query %s: %s", query, mysql_error(connection));
if (die_on_error) { if (die_on_error) {
exit(EXIT_FAILURE); die("failed to execute query %s: %s", query, mysql_error(connection));
} else {
msg("Error: failed to execute query %s: %s", query, mysql_error(connection));
} }
return(NULL); return(NULL);
} }
...@@ -177,9 +178,8 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result, ...@@ -177,9 +178,8 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
/* store result set on client if there is a result */ /* store result set on client if there is a result */
if (mysql_field_count(connection) > 0) { if (mysql_field_count(connection) > 0) {
if ((mysql_result = mysql_store_result(connection)) == NULL) { if ((mysql_result = mysql_store_result(connection)) == NULL) {
msg("Error: failed to fetch query result %s: %s", die("failed to fetch query result %s: %s",
query, mysql_error(connection)); query, mysql_error(connection));
exit(EXIT_FAILURE);
} }
if (!use_result) { if (!use_result) {
...@@ -910,8 +910,7 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *)) ...@@ -910,8 +910,7 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *))
row[1], row[2], row[0]); row[1], row[2], row[0]);
snprintf(query, sizeof(query), "KILL QUERY %s", row[0]); snprintf(query, sizeof(query), "KILL QUERY %s", row[0]);
if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) { if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) {
msg("Error: failed to execute query %s: %s", query,mysql_error(mysql)); die("failed to execute query %s: %s", query,mysql_error(mysql));
exit(EXIT_FAILURE);
} }
} }
mysql_free_result(result); mysql_free_result(result);
......
...@@ -86,9 +86,7 @@ static inline int asprintf(char **strp, const char *fmt,...) ...@@ -86,9 +86,7 @@ static inline int asprintf(char **strp, const char *fmt,...)
#define XB_DELTA_INFO_SUFFIX ".meta" #define XB_DELTA_INFO_SUFFIX ".meta"
static inline int msg1(uint thread_num, const char *prefix, const char *fmt, va_list args)
static inline int msg1(unsigned int thread_num, const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 2, 3);
static inline int msg1(uint thread_num, const char *fmt, va_list args)
{ {
int result; int result;
time_t t = time(NULL); time_t t = time(NULL);
...@@ -98,35 +96,44 @@ static inline int msg1(uint thread_num, const char *fmt, va_list args) ...@@ -98,35 +96,44 @@ static inline int msg1(uint thread_num, const char *fmt, va_list args)
result = vasprintf(&line, fmt, args); result = vasprintf(&line, fmt, args);
if (result != -1) { if (result != -1) {
if (fmt && fmt[strlen(fmt)] != '\n') if (fmt && fmt[strlen(fmt)] != '\n')
result = fprintf(stderr, "[%02u] %s %s\n", thread_num, date, line); result = fprintf(stderr, "[%02u] %s%s %s\n", thread_num, prefix, date, line);
else else
result = fprintf(stderr, "[%02u] %s %s", thread_num, date, line); result = fprintf(stderr, "[%02u] %s%s %s", thread_num, prefix, date, line);
free(line); free(line);
} }
return result; return result;
} }
static inline int msg(unsigned int, const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 2, 3);
static inline int msg(unsigned int thread_num, const char *fmt, ...) static inline ATTRIBUTE_FORMAT(printf, 2, 3) int msg(unsigned int thread_num, const char *fmt, ...)
{ {
int result; int result;
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
result = msg1(thread_num, fmt, args); result = msg1(thread_num,"", fmt, args);
va_end(args); va_end(args);
return result; return result;
} }
static inline int msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); static inline ATTRIBUTE_FORMAT(printf, 1, 2) int msg(const char *fmt, ...)
static inline int msg(const char *fmt, ...)
{ {
int result; int result;
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
result = msg1(0, fmt, args); result = msg1(0, "", fmt, args);
va_end(args); va_end(args);
return result; return result;
} }
static inline ATTRIBUTE_FORMAT(printf, 1,2) ATTRIBUTE_NORETURN void die(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
msg1(0, "FATAL ERROR: ", fmt, args);
va_end(args);
fflush(stderr);
_exit(EXIT_FAILURE);
}
/* Use POSIX_FADV_NORMAL when available */ /* Use POSIX_FADV_NORMAL when available */
......
...@@ -48,8 +48,7 @@ ds_create(const char *root, ds_type_t type) ...@@ -48,8 +48,7 @@ ds_create(const char *root, ds_type_t type)
#ifdef HAVE_LIBARCHIVE #ifdef HAVE_LIBARCHIVE
ds = &datasink_archive; ds = &datasink_archive;
#else #else
msg("Error : mariabackup was built without libarchive support"); die("mariabackup was built without libarchive support");
exit(EXIT_FAILURE);
#endif #endif
break; break;
case DS_TYPE_XBSTREAM: case DS_TYPE_XBSTREAM:
...@@ -60,8 +59,7 @@ ds_create(const char *root, ds_type_t type) ...@@ -60,8 +59,7 @@ ds_create(const char *root, ds_type_t type)
break; break;
case DS_TYPE_ENCRYPT: case DS_TYPE_ENCRYPT:
case DS_TYPE_DECRYPT: case DS_TYPE_DECRYPT:
msg("Error : mariabackup does not support encrypted backups."); die("mariabackup does not support encrypted backups.");
exit(EXIT_FAILURE);
break; break;
case DS_TYPE_TMPFILE: case DS_TYPE_TMPFILE:
...@@ -80,8 +78,7 @@ ds_create(const char *root, ds_type_t type) ...@@ -80,8 +78,7 @@ ds_create(const char *root, ds_type_t type)
if (ctxt != NULL) { if (ctxt != NULL) {
ctxt->datasink = ds; ctxt->datasink = ds;
} else { } else {
msg("Error: failed to initialize datasink."); die("failed to initialize datasink.");
exit(EXIT_FAILURE);
} }
return ctxt; return ctxt;
......
...@@ -96,7 +96,7 @@ buffer_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat) ...@@ -96,7 +96,7 @@ buffer_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
dst_file = ds_open(pipe_ctxt, path, mystat); dst_file = ds_open(pipe_ctxt, path, mystat);
if (dst_file == NULL) { if (dst_file == NULL) {
exit(EXIT_FAILURE); die("ds_open(%s) failed", path);
} }
buffer_ctxt = (ds_buffer_ctxt_t *) ctxt->ptr; buffer_ctxt = (ds_buffer_ctxt_t *) ctxt->ptr;
......
...@@ -195,8 +195,7 @@ tmpfile_deinit(ds_ctxt_t *ctxt) ...@@ -195,8 +195,7 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
/* Stat the file to replace size and mtime on the original /* Stat the file to replace size and mtime on the original
* mystat struct */ * mystat struct */
if (my_fstat(tmp_file->fd, &mystat, MYF(0))) { if (my_fstat(tmp_file->fd, &mystat, MYF(0))) {
msg("error: my_fstat() failed."); die("my_fstat() failed.");
exit(EXIT_FAILURE);
} }
tmp_file->mystat.st_size = mystat.st_size; tmp_file->mystat.st_size = mystat.st_size;
tmp_file->mystat.st_mtime = mystat.st_mtime; tmp_file->mystat.st_mtime = mystat.st_mtime;
...@@ -204,18 +203,16 @@ tmpfile_deinit(ds_ctxt_t *ctxt) ...@@ -204,18 +203,16 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
dst_file = ds_open(pipe_ctxt, tmp_file->orig_path, dst_file = ds_open(pipe_ctxt, tmp_file->orig_path,
&tmp_file->mystat); &tmp_file->mystat);
if (dst_file == NULL) { if (dst_file == NULL) {
msg("error: could not stream a temporary file to " die("could not stream a temporary file to "
"'%s'", tmp_file->orig_path); "'%s'", tmp_file->orig_path);
exit(EXIT_FAILURE);
} }
/* copy to the destination datasink */ /* copy to the destination datasink */
posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL); posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL);
if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) == if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) ==
MY_FILEPOS_ERROR) { MY_FILEPOS_ERROR) {
msg("error: my_seek() failed for '%s', errno = %d.", die("my_seek() failed for '%s', errno = %d.",
tmp_file->file->path, my_errno); tmp_file->file->path, my_errno);
exit(EXIT_FAILURE);
} }
offset = 0; offset = 0;
while ((bytes = my_read(tmp_file->fd, (unsigned char *)buf, buf_size, while ((bytes = my_read(tmp_file->fd, (unsigned char *)buf, buf_size,
...@@ -223,13 +220,12 @@ tmpfile_deinit(ds_ctxt_t *ctxt) ...@@ -223,13 +220,12 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED); posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED);
offset += buf_size; offset += buf_size;
if (ds_write(dst_file, buf, bytes)) { if (ds_write(dst_file, buf, bytes)) {
msg("error: cannot write to stream for '%s'.", die("cannot write to stream for '%s'.",
tmp_file->orig_path); tmp_file->orig_path);
exit(EXIT_FAILURE);
} }
} }
if (bytes == (size_t) -1) { if (bytes == (size_t) -1) {
exit(EXIT_FAILURE); die("my_read failed for %s", tmp_file->orig_path);
} }
my_close(tmp_file->fd, MYF(MY_WME)); my_close(tmp_file->fd, MYF(MY_WME));
......
...@@ -45,8 +45,7 @@ static std::string get_encryption_plugin_from_cnf() ...@@ -45,8 +45,7 @@ static std::string get_encryption_plugin_from_cnf()
FILE *f = fopen("backup-my.cnf", "r"); FILE *f = fopen("backup-my.cnf", "r");
if (!f) if (!f)
{ {
msg("Can't open backup-my.cnf for reading"); die("Can't open backup-my.cnf for reading");
exit(EXIT_FAILURE);
} }
char line[512]; char line[512];
std::string plugin_load; std::string plugin_load;
......
...@@ -193,7 +193,7 @@ xb_write_galera_info(bool incremental_prepare) ...@@ -193,7 +193,7 @@ xb_write_galera_info(bool incremental_prepare)
fp = fopen(XB_GALERA_INFO_FILENAME, "w"); fp = fopen(XB_GALERA_INFO_FILENAME, "w");
if (fp == NULL) { if (fp == NULL) {
msg("mariabackup: error: " die(
"could not create " XB_GALERA_INFO_FILENAME "could not create " XB_GALERA_INFO_FILENAME
", errno = %d\n", ", errno = %d\n",
errno); errno);
...@@ -207,11 +207,10 @@ xb_write_galera_info(bool incremental_prepare) ...@@ -207,11 +207,10 @@ xb_write_galera_info(bool incremental_prepare)
if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) { if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {
msg("mariabackup: error: " die(
"could not write to " XB_GALERA_INFO_FILENAME "could not write to " XB_GALERA_INFO_FILENAME
", errno = %d\n", ", errno = %d\n",
errno); errno);;
exit(EXIT_FAILURE);
} }
fclose(fp); fclose(fp);
......
...@@ -657,9 +657,8 @@ static void backup_file_op_fail(ulint space_id, const byte* flags, ...@@ -657,9 +657,8 @@ static void backup_file_op_fail(ulint space_id, const byte* flags,
msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name);
} }
if (fail) { if (fail) {
msg("ERROR : DDL operation detected in the late phase of backup." die("DDL operation detected in the late phase of backup."
"Backup is inconsistent. Remove --no-lock option to fix."); "Backup is inconsistent. Remove --no-lock option to fix.");
exit(EXIT_FAILURE);
} }
} }
...@@ -1457,8 +1456,7 @@ debug_sync_point(const char *name) ...@@ -1457,8 +1456,7 @@ debug_sync_point(const char *name)
xtrabackup_target_dir); xtrabackup_target_dir);
fp = fopen(pid_path, "w"); fp = fopen(pid_path, "w");
if (fp == NULL) { if (fp == NULL) {
msg("mariabackup: Error: cannot open %s", pid_path); die("Can't open open %s", pid_path);
exit(EXIT_FAILURE);
} }
fprintf(fp, "%u\n", (uint) pid); fprintf(fp, "%u\n", (uint) pid);
fclose(fp); fclose(fp);
...@@ -1794,7 +1792,7 @@ innodb_init_param(void) ...@@ -1794,7 +1792,7 @@ innodb_init_param(void)
memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list)); memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list));
if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
exit(EXIT_FAILURE); die("init_tmpdir() failed");
xtrabackup_tmpdir = my_tmpdir(&mysql_tmpdir_list); xtrabackup_tmpdir = my_tmpdir(&mysql_tmpdir_list);
/* dummy for initialize all_charsets[] */ /* dummy for initialize all_charsets[] */
get_charset_name(0); get_charset_name(0);
...@@ -1811,9 +1809,8 @@ innodb_init_param(void) ...@@ -1811,9 +1809,8 @@ innodb_init_param(void)
msg("InnoDB: The page size of the " msg("InnoDB: The page size of the "
"database is set to %lu.", srv_page_size); "database is set to %lu.", srv_page_size);
} else { } else {
msg("InnoDB: Error: invalid value of " die("invalid value of "
"innobase_page_size: %lld", innobase_page_size); "innobase_page_size: %lld", innobase_page_size);
exit(EXIT_FAILURE);
} }
} else { } else {
srv_page_size_shift = 14; srv_page_size_shift = 14;
...@@ -2766,8 +2763,7 @@ static bool xtrabackup_copy_logfile(bool last = false) ...@@ -2766,8 +2763,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
log_mutex_exit(); log_mutex_exit();
if (!start_lsn) { if (!start_lsn) {
msg("Error: xtrabackup_copy_logfile() failed."); die("xtrabackup_copy_logfile() failed.");
exit(EXIT_FAILURE);
} }
} while (start_lsn == end_lsn); } while (start_lsn == end_lsn);
...@@ -2916,8 +2912,7 @@ data_copy_thread_func( ...@@ -2916,8 +2912,7 @@ data_copy_thread_func(
DBUG_MARIABACKUP_EVENT("before_copy", node->space->name); DBUG_MARIABACKUP_EVENT("before_copy", node->space->name);
/* copy the datafile */ /* copy the datafile */
if(xtrabackup_copy_datafile(node, num)) { if(xtrabackup_copy_datafile(node, num)) {
msg(num,"mariabackup: Error: failed to copy datafile."); die("failed to copy datafile.");
exit(EXIT_FAILURE);
} }
DBUG_MARIABACKUP_EVENT("after_copy", node->space->name); DBUG_MARIABACKUP_EVENT("after_copy", node->space->name);
...@@ -3094,9 +3089,7 @@ xb_load_single_table_tablespace( ...@@ -3094,9 +3089,7 @@ xb_load_single_table_tablespace(
Datafile *file = xb_new_datafile(name, is_remote); Datafile *file = xb_new_datafile(name, is_remote);
if (file->open_read_only(true) != DB_SUCCESS) { if (file->open_read_only(true) != DB_SUCCESS) {
msg("Can't open datafile %s", name); die("Can't open datafile %s", name);
ut_free(name);
exit(EXIT_FAILURE);
} }
err = file->validate_first_page(&flush_lsn); err = file->validate_first_page(&flush_lsn);
...@@ -3134,7 +3127,7 @@ xb_load_single_table_tablespace( ...@@ -3134,7 +3127,7 @@ xb_load_single_table_tablespace(
if (err != DB_SUCCESS && err != DB_CORRUPTION && xtrabackup_backup) { if (err != DB_SUCCESS && err != DB_CORRUPTION && xtrabackup_backup) {
/* allow corrupted first page for xtrabackup, it could be just /* allow corrupted first page for xtrabackup, it could be just
zero-filled page, which we restore from redo log later */ zero-filled page, which we restore from redo log later */
exit(EXIT_FAILURE); die("Failed to not validate first page of the file %s, error %d",name, (int)err);
} }
} }
...@@ -3505,13 +3498,11 @@ xb_validate_name( ...@@ -3505,13 +3498,11 @@ xb_validate_name(
/* perform only basic validation. validate length and /* perform only basic validation. validate length and
path symbols */ path symbols */
if (len > NAME_LEN) { if (len > NAME_LEN) {
msg("mariabackup: name `%s` is too long.", name); die("name `%s` is too long.", name);
exit(EXIT_FAILURE);
} }
p = strpbrk(name, "/\\~"); p = strpbrk(name, "/\\~");
if (p && (uint) (p - name) < NAME_LEN) { if (p && (uint) (p - name) < NAME_LEN) {
msg("mariabackup: name `%s` is not valid.", name); die("name `%s` is not valid.", name);
exit(EXIT_FAILURE);
} }
} }
...@@ -3589,8 +3580,7 @@ xb_register_table( ...@@ -3589,8 +3580,7 @@ xb_register_table(
const char* name) /*!< in: name of table */ const char* name) /*!< in: name of table */
{ {
if (strchr(name, '.') == NULL) { if (strchr(name, '.') == NULL) {
msg("mariabackup: `%s` is not fully qualified name.", name); die("`%s` is not fully qualified name.", name);
exit(EXIT_FAILURE);
} }
xb_register_include_filter_entry(name); xb_register_include_filter_entry(name);
...@@ -3680,17 +3670,15 @@ xb_load_list_file( ...@@ -3680,17 +3670,15 @@ xb_load_list_file(
/* read and store the filenames */ /* read and store the filenames */
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (!fp) { if (!fp) {
msg("mariabackup: cannot open %s", die("Can't open %s",
filename); filename);
exit(EXIT_FAILURE);
} }
while (fgets(name_buf, sizeof(name_buf), fp) != NULL) { while (fgets(name_buf, sizeof(name_buf), fp) != NULL) {
char* p = strchr(name_buf, '\n'); char* p = strchr(name_buf, '\n');
if (p) { if (p) {
*p = '\0'; *p = '\0';
} else { } else {
msg("mariabackup: `%s...` name is too long", name_buf); die("`%s...` name is too long", name_buf);
exit(EXIT_FAILURE);
} }
ins(name_buf); ins(name_buf);
...@@ -4797,9 +4785,8 @@ xb_delta_open_matching_space( ...@@ -4797,9 +4785,8 @@ xb_delta_open_matching_space(
if (info.space_id == ULINT_UNDEFINED) if (info.space_id == ULINT_UNDEFINED)
{ {
msg("mariabackup: Error: Cannot handle DDL operation on tablespace " die("Can't handle DDL operation on tablespace "
"%s\n", dest_space_name); "%s\n", dest_space_name);
exit(EXIT_FAILURE);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system->mutex);
fil_space = fil_space_get_by_id(info.space_id); fil_space = fil_space_get_by_id(info.space_id);
...@@ -5093,8 +5080,7 @@ std::string change_extension(std::string filename, std::string new_ext) { ...@@ -5093,8 +5080,7 @@ std::string change_extension(std::string filename, std::string new_ext) {
static void rename_file(const char *from,const char *to) { static void rename_file(const char *from,const char *to) {
msg("Renaming %s to %s\n", from, to); msg("Renaming %s to %s\n", from, to);
if (my_rename(from, to, MY_WME)) { if (my_rename(from, to, MY_WME)) {
msg("Can't rename %s to %s errno %d", from, to, errno); die("Can't rename %s to %s errno %d", from, to, errno);
exit(EXIT_FAILURE);
} }
} }
...@@ -5371,8 +5357,7 @@ static void delete_file(const std::string& file, bool if_exists = false) { ...@@ -5371,8 +5357,7 @@ static void delete_file(const std::string& file, bool if_exists = false) {
if (if_exists && !file_exists(file)) if (if_exists && !file_exists(file))
return; return;
if (my_delete(file.c_str(), MYF(MY_WME))) { if (my_delete(file.c_str(), MYF(MY_WME))) {
msg("Can't remove %s, errno %d", file.c_str(), errno); die("Can't remove %s, errno %d", file.c_str(), errno);
exit(EXIT_FAILURE);
} }
} }
...@@ -5757,7 +5742,7 @@ has_privilege(const std::list<std::string> &granted, ...@@ -5757,7 +5742,7 @@ has_privilege(const std::list<std::string> &granted,
required, db_name, table_name); required, db_name, table_name);
if (written < 0 || written == sizeof(buffer) if (written < 0 || written == sizeof(buffer)
|| regcomp(&priv_re, buffer, REG_EXTENDED)) { || regcomp(&priv_re, buffer, REG_EXTENDED)) {
exit(EXIT_FAILURE); die("regcomp() failed for '%s'", buffer);
} }
typedef std::list<std::string>::const_iterator string_iter; typedef std::list<std::string>::const_iterator string_iter;
...@@ -5871,7 +5856,7 @@ check_all_privileges() ...@@ -5871,7 +5856,7 @@ check_all_privileges()
if (check_result & PRIVILEGE_ERROR) { if (check_result & PRIVILEGE_ERROR) {
mysql_close(mysql_connection); mysql_close(mysql_connection);
exit(EXIT_FAILURE); die("Insufficient privileges");
} }
} }
...@@ -6111,20 +6096,12 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) ...@@ -6111,20 +6096,12 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server)
if (optend - argv[i] == 15 && if (optend - argv[i] == 15 &&
!strncmp(argv[i], "--defaults-file", optend - argv[i])) { !strncmp(argv[i], "--defaults-file", optend - argv[i])) {
die("--defaults-file must be specified first on the command line");
msg("mariabackup: Error: --defaults-file "
"must be specified first on the command "
"line");
exit(EXIT_FAILURE);
} }
if (optend - argv[i] == 21 && if (optend - argv[i] == 21 &&
!strncmp(argv[i], "--defaults-extra-file", !strncmp(argv[i], "--defaults-extra-file",
optend - argv[i])) { optend - argv[i])) {
die("--defaults-extra-file must be specified first on the command line");
msg("mariabackup: Error: --defaults-extra-file "
"must be specified first on the command "
"line\n");
exit(EXIT_FAILURE);
} }
} }
...@@ -6227,7 +6204,7 @@ int main(int argc, char **argv) ...@@ -6227,7 +6204,7 @@ int main(int argc, char **argv)
if (mysql_server_init(-1, NULL, NULL)) if (mysql_server_init(-1, NULL, NULL))
{ {
exit(EXIT_FAILURE); die("mysql_server_init() failed");
} }
system_charset_info = &my_charset_utf8_general_ci; system_charset_info = &my_charset_utf8_general_ci;
......
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