Fix debug assert to match its intention.

Do not check my_errno before it is set, check errno instead.
Also, do not check errno, if prior pread() did not fail.
This commit is contained in:
Vladislav Vaintroub 2019-06-17 19:01:15 +01:00
parent 5804bb4ef0
commit 71eea0c3fb

View File

@ -69,7 +69,7 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
if (readbytes != Count)
{
/* We should never read with wrong file descriptor! */
DBUG_ASSERT(my_errno != EBADF);
DBUG_ASSERT(readbytes != (size_t)-1 || errno != EBADF);
my_errno= errno;
if (errno == 0 || (readbytes != (size_t) -1 &&
(MyFlags & (MY_NABP | MY_FNABP))))