summaryrefslogtreecommitdiff
path: root/mysys/my_pread.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-11-22 18:04:38 +0100
committerSergei Golubchik <sergii@pisem.net>2011-11-22 18:04:38 +0100
commitd2755a2c9c109ddb4e2e0c9feda89431a6c4fd50 (patch)
treec6e4678908c750d7f558e98cedc349aa1d350892 /mysys/my_pread.c
parentaf32b02c06f32a89dc9f52e556bc5dd3bf49c19e (diff)
parent42221abaed700f6dc5d280b462755851780e8487 (diff)
downloadmariadb-git-d2755a2c9c109ddb4e2e0c9feda89431a6c4fd50.tar.gz
5.3->5.5 merge
Diffstat (limited to 'mysys/my_pread.c')
-rw-r--r--mysys/my_pread.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index 4aa12eec33c..51b4c5f5599 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -51,8 +51,13 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
int error= 0;
DBUG_ENTER("my_pread");
+
DBUG_PRINT("my",("fd: %d Seek: %llu Buffer: %p Count: %lu MyFlags: %d",
Filedes, (ulonglong)offset, Buffer, (ulong)Count, MyFlags));
+
+ if (!(MyFlags & (MY_WME | MY_FAE | MY_FNABP)))
+ MyFlags|= my_global_flags;
+
for (;;)
{
errno= 0; /* Linux, Windows don't reset this on EOF/success */
@@ -79,11 +84,13 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
}
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
- if (readbytes == (size_t) -1)
- my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- else if (MyFlags & (MY_NABP | MY_FNABP))
- my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
+ if (readbytes == (size_t) -1)
+ my_error(EE_READ,
+ MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))),
+ my_filename(Filedes),my_errno);
+ else if (MyFlags & (MY_NABP | MY_FNABP))
+ my_error(EE_EOFERR,
+ MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))),
my_filename(Filedes),my_errno);
}
if (readbytes == (size_t) -1 || (MyFlags & (MY_FNABP | MY_NABP)))
@@ -127,6 +134,8 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count,
Filedes, (ulonglong)offset, Buffer, (ulong)Count, MyFlags));
errors= 0;
written= 0;
+ if (!(MyFlags & (MY_WME | MY_FAE | MY_FNABP)))
+ MyFlags|= my_global_flags;
for (;;)
{
@@ -159,20 +168,19 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count,
if ((writtenbytes && writtenbytes != (size_t) -1) || my_errno == EINTR)
continue; /* Retry */
#endif
+
+ /* Don't give a warning if it's ok that we only write part of the data */
if (MyFlags & (MY_NABP | MY_FNABP))
{
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
- {
- my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG),
+ my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))),
my_filename(Filedes),my_errno);
- }
- DBUG_RETURN(MY_FILE_ERROR); /* Error on read */
+ DBUG_RETURN(MY_FILE_ERROR); /* Error on write */
}
- else
- break; /* Return bytes written */
+ break; /* Return bytes written */
}
DBUG_EXECUTE_IF("check", my_seek(Filedes, -1, SEEK_SET, MYF(0)););
if (MyFlags & (MY_NABP | MY_FNABP))
- DBUG_RETURN(0); /* Want only errors */
- DBUG_RETURN(writtenbytes+written); /* purecov: inspected */
+ DBUG_RETURN(0); /* Want only errors */
+ DBUG_RETURN(writtenbytes+written); /* purecov: inspected */
} /* my_pwrite */