diff options
Diffstat (limited to 'ext/mysql/libmysql/my_write.c')
-rw-r--r-- | ext/mysql/libmysql/my_write.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/ext/mysql/libmysql/my_write.c b/ext/mysql/libmysql/my_write.c index ac791ebc2f..d66e1da031 100644 --- a/ext/mysql/libmysql/my_write.c +++ b/ext/mysql/libmysql/my_write.c @@ -27,13 +27,15 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags) Count-=writenbytes; } my_errno=errno; - DBUG_PRINT("error",("Write only %d bytes",writenbytes)); + DBUG_PRINT("error",("Write only %d bytes, error: %d", + writenbytes,my_errno)); #ifndef NO_BACKGROUND #ifdef THREAD if (my_thread_var->abort) MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ #endif - if (my_errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL)) + if (my_errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL) && + (uint) writenbytes != (uint) -1) { if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE)) my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), @@ -41,8 +43,18 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags) VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC)); continue; } - if ((writenbytes == 0 && my_errno == EINTR) || - (writenbytes > 0 && (uint) writenbytes != (uint) -1)) + if (!writenbytes) + { + /* We may come here on an interrupt or if the file quote is exeeded */ + if (my_errno == EINTR) + continue; + if (!errors++) /* Retry once */ + { + errno=EFBIG; /* Assume this is the error */ + continue; + } + } + else if ((uint) writenbytes != (uint) -1) continue; /* Retry */ #endif if (MyFlags & (MY_NABP | MY_FNABP)) |