List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:July 1 2008 1:34pm
Subject:bzr commit into mysql-6.0-backup branch (svoj:2643)
View as plain text  
#At file:///home/svoj/devel/bzr-mysql/mysql-6.0-backup/

 2643 Sergey Vojtovich	2008-07-01 [merge]
      Auto merged.
modified:
  sql/backup/stream.cc

per-file messages:
  sql/backup/stream.cc
    Auto merged.
=== modified file 'sql/backup/stream.cc'
--- a/sql/backup/stream.cc	2008-06-26 10:38:48 +0000
+++ b/sql/backup/stream.cc	2008-07-01 13:12:03 +0000
@@ -1,4 +1,5 @@
 #include "../mysql_priv.h"
+#include "my_dir.h"
 
 #include "backup_stream.h"
 #include "stream.h"
@@ -129,8 +130,8 @@ extern "C" int stream_read(void *instanc
     {
       if (!zstream->avail_in)
       {
-        zstream->avail_in= my_read(fd, s->zbuf, ZBUF_SIZE, MYF(0));
-        if (zstream->avail_in == (size_t) -1)
+        zstream->avail_in= (uInt) my_read(fd, s->zbuf, ZBUF_SIZE, MYF(0));
+        if (zstream->avail_in == (uInt) -1)
           DBUG_RETURN(BSTREAM_ERROR);
         else if (!zstream->avail_in)
           break;
@@ -215,7 +216,7 @@ bool Stream::rewind()
 
 Output_stream::Output_stream(Logger &log, const ::String &name,
                              bool with_compression)
-  :Stream(log, name, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC)
+  :Stream(log, name, 0)
 {
   m_with_compression= with_compression;
   stream.write= stream_write;
@@ -284,8 +285,16 @@ bool Output_stream::init()
 */
 bool Output_stream::open()
 {
+  MY_STAT stat_info;
   close();
 
+  /* Allow to write to existing named pipe */
+  if (my_stat(m_path.c_ptr(), &stat_info, MYF(0)) &&
+      MY_S_ISFIFO(stat_info.st_mode))
+    m_flags= O_WRONLY;
+  else
+    m_flags= O_WRONLY|O_CREAT|O_EXCL|O_TRUNC;
+
   bool ret= Stream::open();
 
   if (!ret)

Thread
bzr commit into mysql-6.0-backup branch (svoj:2643) Sergey Vojtovich1 Jul