Comment 1 for bug 1304310

Revision history for this message
Jan Schlüter (f0k) wrote :

The problem is the `write_data` function at the end of `mydumper.c`. It has a loop that runs until all requested bytes have been written, and it has two bugs:
a) It only catches the case of `write` or `gzwrite` returning -1, but `gzwrite` can also return zero in case of an error: http://refspecs.linuxbase.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/zlib-gzwrite-1.html
b) If not all requested bytes are written, the next loop iteration will try to write the same number of bytes again, starting from a different memory position. It will read past the buffer of data to write. Apparently this never happened.

I've attached a patch that fixes this. (The `FindMySQL.cmake` is also severely broken, but I circumvented the problems by manually editing the `CMakeCache.txt`.)