summaryrefslogtreecommitdiff
path: root/client/mysqlbinlog.cc
diff options
context:
space:
mode:
authorunknown <cbell/Chuck@mysql_cab.>2006-11-01 10:56:43 -0500
committerunknown <cbell/Chuck@mysql_cab.>2006-11-01 10:56:43 -0500
commitf004118079e1837bb88c4a9b4c28369a0f2bd362 (patch)
tree007fe00021dd2d4307cd1676c579741082733b73 /client/mysqlbinlog.cc
parent27bbf36f87138ee434f629756a543fa7caf9f789 (diff)
downloadmariadb-git-f004118079e1837bb88c4a9b4c28369a0f2bd362.tar.gz
BUG#23735 Test rpl_row_mysqlbinlog fails on Windows. The errors report a file discrepency on reading a binlog from the command line.
client/mysqlbinlog.cc: BUG#23735 Test rpl_row_mysqlbinlog fails on Windows.
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r--client/mysqlbinlog.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index ab94c415db7..74d611ed0f2 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1360,6 +1360,24 @@ static int dump_local_log_entries(const char* logname)
}
else // reading from stdin;
{
+ /*
+ Bug fix: #23735
+ Author: Chuck Bell
+ Description:
+ Windows opens stdin in text mode by default. Certain characters
+ such as CTRL-Z are interpeted as events and the read() method
+ will stop. CTRL-Z is the EOF marker in Windows. to get past this
+ you have to open stdin in binary mode. Setmode() is used to set
+ stdin in binary mode. Errors on setting this mode result in
+ halting the function and printing an error message to stderr.
+ */
+#if defined (__WIN__) || (_WIN64)
+ if (_setmode(fileno(stdin), O_BINARY) == -1)
+ {
+ fprintf(stderr, "Could not set binary mode on stdin.\n");
+ return 1;
+ }
+#endif
if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0,
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
return 1;