From: Date: December 11 2006 11:25am Subject: bk commit into 5.0 tree (msvensson:1.2348) BUG#23735 List-Archive: http://lists.mysql.com/commits/16760 X-Bug: 23735 Message-Id: <20061211102550.5EE8986DF4F@neptunus.localdomain> Below is the list of changes that have just been committed into a local 5.0 repository of msvensson. When msvensson does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2006-12-11 11:25:45+01:00, msvensson@neptunus.(none) +1 -0 Bug#23735 mysqlbinlog client fails when reading binlog from stdin - 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. client/mysqlbinlog.cc@stripped, 2006-12-11 11:25:42+01:00, msvensson@neptunus.(none) +19 -0 Apply fix to 5.0 as well # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: msvensson # Host: neptunus.(none) # Root: /home/msvensson/mysql/mysql-5.0-maint --- 1.130/client/mysqlbinlog.cc 2006-12-11 11:25:50 +01:00 +++ 1.131/client/mysqlbinlog.cc 2006-12-11 11:25:50 +01:00 @@ -1310,6 +1310,25 @@ static int dump_local_log_entries(const } 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;