summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorNarayanan V <v.narayanan@sun.com>2009-03-05 15:18:03 +0530
committerNarayanan V <v.narayanan@sun.com>2009-03-05 15:18:03 +0530
commit31443a6f73076374790ae359c1e0f00ddc0bfd4a (patch)
tree4a6a6bb991ded38bc6af8795dc921b611f02363f /sql/log.cc
parent16c0631f0b785e82aef63429b5a4e7179b8aa52e (diff)
downloadmariadb-git-31443a6f73076374790ae359c1e0f00ddc0bfd4a.tar.gz
Bug#42790 Test 'main.innodb' fails from "InnoDB: Error: in ALTER TABLE"
The problem here seem to be that when mysql is redirecting stderr to a file, stderr becomes buffered, whereas it is unbuffered by definition. The solution is to unbuffer it by setting buffer to null. sql/log.cc: use setbuf(stderr, NULL) to set the buffer to null. sql/mysqld.cc: use setbuf(stderr, NULL) to set the buffer to null.
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 74dc75702ae..44296daa939 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -4650,10 +4650,14 @@ bool flush_error_log()
uchar buf[IO_SIZE];
freopen(err_temp,"a+",stderr);
+ setbuf(stderr, NULL);
(void) my_delete(err_renamed, MYF(0));
my_rename(log_error_file,err_renamed,MYF(0));
if (freopen(log_error_file,"a+",stdout))
+ {
freopen(log_error_file,"a+",stderr);
+ setbuf(stderr, NULL);
+ }
if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
{
@@ -4669,7 +4673,10 @@ bool flush_error_log()
#else
my_rename(log_error_file,err_renamed,MYF(0));
if (freopen(log_error_file,"a+",stdout))
+ {
freopen(log_error_file,"a+",stderr);
+ setbuf(stderr, NULL);
+ }
else
result= 1;
#endif