summaryrefslogtreecommitdiff
path: root/client/mysqlbinlog.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-10-16 13:04:42 +0200
committerSergei Golubchik <sergii@pisem.net>2012-10-16 13:04:42 +0200
commitee9afef27141f55165009fdbd58e54942f3a6867 (patch)
treeb5e15e62e10daa40aef3e6d33eeabf9205d1be0f /client/mysqlbinlog.cc
parentd9a8799205d160688f81362356dd2323eb8a91ea (diff)
parenta619bfad30c13207fb0453a85af5740846186900 (diff)
downloadmariadb-git-ee9afef27141f55165009fdbd58e54942f3a6867.tar.gz
mysql-5.5.28
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r--client/mysqlbinlog.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 2c1687c6c90..777e68902dd 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -38,6 +38,9 @@
#include "sql_priv.h"
#include "log_event.h"
#include "sql_common.h"
+#include "my_dir.h"
+#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
+
#include "sql_string.h" // needed for Rpl_filter
#include "sql_list.h" // needed for Rpl_filter
@@ -1501,10 +1504,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");
@@ -2073,6 +2073,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)))
@@ -2082,7 +2083,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.");