2 +++ b/mysql-test/r/percona_bug933969.result
5 +DROP TABLE IF EXISTS t1;
6 +CREATE TABLE t1 (word VARCHAR(20));
7 +INSERT INTO t1 VALUES ("hamite");
8 +INSERT INTO t1 VALUES ("hoho");
9 +INSERT INTO t1 VALUES ("znamenito");
10 +INSERT INTO t1 VALUES ("mrachny");
11 +INSERT INTO t1 VALUES ("mrak");
12 +INSERT INTO t1 VALUES ("zhut");
13 +INSERT INTO t1 VALUES ("parnisha");
14 +INSERT INTO t1 VALUES ("krrasota!");
15 +INSERT INTO t1 VALUES ("podumayesh");
16 +INSERT INTO t1 VALUES ("ogo!");
21 +++ b/mysql-test/t/percona_bug933969.test
23 +###################### percona_bug933969.test ########################
24 +# Bug #933969: mysqlbinlog doesn't accept stdin #
26 +# The goal of this testcase is to test that mysqlbinlog handle #
27 +# stdin correctly when stdin is pipe. #
28 +# i.e. "cat log | mysqlbinlog -" don't cause mysqlbinlog failure #
29 +######################################################################
30 +-- source include/have_log_bin.inc
31 +-- source include/not_windows.inc
32 +-- source include/not_embedded.inc
34 +# deletes all the binary logs
38 +DROP TABLE IF EXISTS t1;
41 +# produce some statements for binlog
43 +CREATE TABLE t1 (word VARCHAR(20));
45 +INSERT INTO t1 VALUES ("hamite");
46 +INSERT INTO t1 VALUES ("hoho");
47 +INSERT INTO t1 VALUES ("znamenito");
48 +INSERT INTO t1 VALUES ("mrachny");
49 +INSERT INTO t1 VALUES ("mrak");
50 +INSERT INTO t1 VALUES ("zhut");
51 +INSERT INTO t1 VALUES ("parnisha");
52 +INSERT INTO t1 VALUES ("krrasota!");
53 +INSERT INTO t1 VALUES ("podumayesh");
54 +INSERT INTO t1 VALUES ("ogo!");
58 +# run mysqlbinlog and make sure it ends normally
60 +let $MYSQLD_DATADIR= `SELECT @@datadir`;
61 +--system cat $MYSQLD_DATADIR/master-bin.000001 | $MYSQL_BINLOG - >/dev/null
65 --- a/client/mysqlbinlog.cc
66 +++ b/client/mysqlbinlog.cc
71 - my_b_seek(file, (my_off_t)0);
72 + DBUG_ASSERT(pos == 0);
73 if (my_b_read(file, header, sizeof(header)))
75 error("Failed reading header; probably an empty file.");
77 /* read from normal file */
78 if ((fd = my_open(logname, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
80 - if (init_io_cache(file, fd, 0, READ_CACHE, start_position_mot, 0,
81 + if (init_io_cache(file, fd, 0, READ_CACHE, (my_off_t) 0, 0,
82 MYF(MY_WME | MY_NABP)))
84 my_close(fd, MYF(MY_WME));
87 if ((retval= check_header(file, print_event_info, logname)) != OK_CONTINUE)
89 + my_b_seek(file, start_position_mot);