summaryrefslogtreecommitdiff
path: root/mysys/my_pread.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/my_pread.c')
-rw-r--r--mysys/my_pread.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index de7a2b611ed..821d8636d8e 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -15,6 +15,7 @@
#include "mysys_priv.h"
#include "mysys_err.h"
+#include "my_base.h"
#include <errno.h>
#ifdef HAVE_PREAD
#include <unistd.h>
@@ -63,7 +64,11 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
pthread_mutex_unlock(&my_file_info[Filedes].mutex);
#else
if ((error= ((readbytes= pread(Filedes, Buffer, Count, offset)) != Count)))
- my_errno= errno ? errno : -1;
+ {
+ my_errno= errno;
+ if (errno == 0 || (errno == -1 && (MyFlags & (MY_NABP | MY_FNABP))))
+ my_errno= HA_ERR_FILE_TOO_SHORT;
+ }
#endif
if (error || readbytes != Count)
{