diff options
author | unknown <timour@askmonty.org> | 2012-11-06 11:52:55 +0200 |
---|---|---|
committer | unknown <timour@askmonty.org> | 2012-11-06 11:52:55 +0200 |
commit | 7c23d6d0c66cb3b84cb466f956e19bfea0acc342 (patch) | |
tree | 551dd23a43a26923a6dd30096a2822a27a90f355 /client/mysqlbinlog.cc | |
parent | 43293b7a515dbb2cf04907e2d98bcc813279cad8 (diff) | |
parent | 813b661d00123e3291530d102e2b94388f42fb0f (diff) | |
download | mariadb-git-7c23d6d0c66cb3b84cb466f956e19bfea0acc342.tar.gz |
Merge MySQL 5.1.66 -> MariaDB 5.1.65
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r-- | client/mysqlbinlog.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 6ec67766a94..8ac00052f97 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -36,6 +36,8 @@ #include "mysql_priv.h" #include "log_event.h" #include "sql_common.h" +#include "my_dir.h" +#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE #define BIN_LOG_HEADER_SIZE 4 #define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4) @@ -1273,10 +1275,7 @@ static void print_version() static void usage() { print_version(); - puts("By Monty and Sasha, for your professional use\n\ -This software comes with NO WARRANTY: This is free software,\n\ -and you are welcome to modify and redistribute it under the GPL license.\n"); - + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("\ Dumps a MySQL binary log in a format usable for viewing or for piping to\n\ the mysql command line client.\n\n"); @@ -1773,6 +1772,7 @@ static Exit_status check_header(IO_CACHE* file, uchar header[BIN_LOG_HEADER_SIZE]; uchar buf[PROBE_HEADER_LEN]; my_off_t tmp_pos, pos; + MY_STAT my_file_stat; delete glob_description_event; if (!(glob_description_event= new Format_description_log_event(3))) @@ -1782,7 +1782,16 @@ static Exit_status check_header(IO_CACHE* file, } pos= my_b_tell(file); - my_b_seek(file, (my_off_t)0); + + /* fstat the file to check if the file is a regular file. */ + if (my_fstat(file->file, &my_file_stat, MYF(0)) == -1) + { + error("Unable to stat the file."); + return ERROR_STOP; + } + if ((my_file_stat.st_mode & S_IFMT) == S_IFREG) + my_b_seek(file, (my_off_t)0); + if (my_b_read(file, header, sizeof(header))) { error("Failed reading header; probably an empty file."); |