From d7a1f97c15fc5adaaf3116b8fb9ee32783498165 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Sep 2006 23:19:24 -0600 Subject: Bug #4053: too many of "error 1236: 'binlog truncated in the middle of event' from master" - Fix my_read/my_write to handle return values from read/write correctly - Add debugging 'deprecated function' warning to my_lread/my_lwrite - Add debugging 'error, read/write interrupt not handled' warning to my_quick_read/my_quick_write There is no test case associated with these changes. However, this is a conservative change, and no repeatable test case is available. mysys/my_lread.c: Warn about using deprecated function. mysys/my_lwrite.c: Warn about using deprecated function. mysys/my_pread.c: Handle interrupted read() or write() (EINTR) properly mysys/my_quick.c: Warn about interrupted read() or write(), which is not handled by my_quick_read() or my_quick_write(). mysys/my_read.c: Handle interrupted read() (EINTR) properly mysys/my_write.c: Handle interrupted write() (EINTR) properly --- mysys/my_pread.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'mysys/my_pread.c') diff --git a/mysys/my_pread.c b/mysys/my_pread.c index f76233fc4cc..70990ad12a6 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -52,8 +52,12 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset, DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d", readbytes,Count,Filedes,my_errno)); #ifdef THREAD - if (readbytes == 0 && errno == EINTR) - continue; /* Interrupted */ + if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR) + { + DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d", + (int) readbytes)); + continue; /* Interrupted */ + } #endif if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { @@ -124,8 +128,8 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset, VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC)); continue; } - if ((writenbytes == 0 && my_errno == EINTR) || - (writenbytes > 0 && (uint) writenbytes != (uint) -1)) + if ((writenbytes > 0 && (uint) writenbytes != (uint) -1) || + my_errno == EINTR) continue; /* Retry */ #endif if (MyFlags & (MY_NABP | MY_FNABP)) -- cgit v1.2.1