2666 Vladislav Vaintroub 2008-07-23
Post-merge fixes
modified:
mysys/my_pread.c
2665 Vladislav Vaintroub 2008-07-23
Fix compile warning
modified:
mysys/mysys_priv.h
=== modified file 'mysys/my_pread.c'
--- a/mysys/my_pread.c 2008-07-23 08:52:08 +0000
+++ b/mysys/my_pread.c 2008-07-23 13:24:34 +0000
@@ -50,24 +50,20 @@ size_t my_pread(File Filedes, uchar *Buf
{
size_t readbytes;
int error= 0;
-#if !defined (HAVE_PREAD) && !defined (__WIN__)
+#if !defined (HAVE_PREAD) && !defined (_WIN32)
int save_errno;
#endif
-#ifndef DBUG_OFF
- char llbuf[22];
DBUG_ENTER("my_pread");
- DBUG_PRINT("my",("fd: %d Seek: %s Buffer: %p Count: %lu MyFlags: %d",
- Filedes, ullstr(offset, llbuf), Buffer,
- (ulong)Count, MyFlags));
-#endif
+ DBUG_PRINT("my",("fd: %d Seek: %llu Buffer: %p Count: %lu MyFlags: %d",
+ Filedes, (ulonglong)offset, Buffer, (ulong)Count, MyFlags));
for (;;)
{
- errno=0; /* Linux, Windows don't reset this on EOF/success */
+ errno=0; /* Linux, Windows don't reset this on EOF/success */
#if !defined (HAVE_PREAD) && !defined (_WIN32)
pthread_mutex_lock(&my_file_info[Filedes].mutex);
readbytes= (uint) -1;
error= (lseek(Filedes, offset, MY_SEEK_SET) == (my_off_t) -1 ||
- (readbytes= read(Filedes, Buffer, Count)) != Count);
+ (readbytes= read(Filedes, Buffer, Count)) != Count);
save_errno= errno;
pthread_mutex_unlock(&my_file_info[Filedes].mutex);
if (error)
@@ -81,13 +77,12 @@ size_t my_pread(File Filedes, uchar *Buf
error= (readbytes != Count);
#endif
if(error)
+ {
my_errno= errno ? errno : -1;
- if (errno == 0 || (readbytes != (size_t) -1 &&
+ if (errno == 0 || (readbytes != (size_t) -1 &&
(MyFlags & (MY_NABP | MY_FNABP))))
- my_errno= HA_ERR_FILE_TOO_SHORT;
- if (error || readbytes != Count)
- {
-
+ my_errno= HA_ERR_FILE_TOO_SHORT;
+
DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d",
(int) readbytes, (uint) Count,Filedes,my_errno));
#ifdef THREAD
@@ -100,19 +95,19 @@ size_t my_pread(File Filedes, uchar *Buf
#endif
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),
- my_filename(Filedes),my_errno);
+ 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),
+ my_filename(Filedes),my_errno);
}
if (readbytes == (size_t) -1 || (MyFlags & (MY_FNABP | MY_NABP)))
- DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
+ DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
}
if (MyFlags & (MY_NABP | MY_FNABP))
- DBUG_RETURN(0); /* Read went ok; Return 0 */
- DBUG_RETURN(readbytes); /* purecov: inspected */
+ DBUG_RETURN(0); /* Read went ok; Return 0 */
+ DBUG_RETURN(readbytes); /* purecov: inspected */
}
} /* my_pread */
@@ -143,13 +138,10 @@ size_t my_pwrite(File Filedes, const uch
{
size_t writtenbytes, written;
uint errors;
-#ifndef DBUG_OFF
- char llbuf[22];
+
DBUG_ENTER("my_pwrite");
- DBUG_PRINT("my",("fd: %d Seek: %s Buffer: %p Count: %lu MyFlags: %d",
- Filedes, ullstr(offset, llbuf), Buffer,
- (ulong)Count, MyFlags));
-#endif
+ DBUG_PRINT("my",("fd: %d Seek: %llu Buffer: %p Count: %lu MyFlags: %d",
+ Filedes, offset, Buffer, (ulong)Count, MyFlags));
errors= 0;
written= 0;
@@ -173,7 +165,7 @@ size_t my_pwrite(File Filedes, const uch
break;
my_errno= errno;
if (writtenbytes != (size_t) -1)
- { /* Safegueard */
+ {
written+= writtenbytes;
Buffer+= writtenbytes;
Count-= writtenbytes;
@@ -189,9 +181,9 @@ size_t my_pwrite(File Filedes, const uch
(MyFlags & MY_WAIT_IF_FULL))
{
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
- my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
- (void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
+ my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
+ my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
+ sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
continue;
}
if ((writtenbytes && writtenbytes != (size_t) -1) || my_errno == EINTR)
@@ -201,8 +193,8 @@ size_t my_pwrite(File Filedes, const uch
{
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
- my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG),
- my_filename(Filedes),my_errno);
+ my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG),
+ my_filename(Filedes),my_errno);
}
DBUG_RETURN(MY_FILE_ERROR); /* Error on read */
}
| Thread |
|---|
| • bzr push into mysql-6.0-wtf branch (vvaintroub:2665 to 2666) | Vladislav Vaintroub | 23 Jul |