Fixed test when exeeding file quota on write

Sanity checks when opening MyISAM files


Docs/manual.texi:
  Added information about Borland c++
myisam/mi_check.c:
  Cleanup
myisam/mi_open.c:
  Added sanity checking
myisam/myisamchk.c:
  Better error messages
mysys/my_chsize.c:
  Cleanup
mysys/my_seek.c:
  Changed debug message
mysys/my_write.c:
  Fixed test when exeeding file quota
This commit is contained in:
unknown 2001-01-15 17:17:43 +02:00
commit 4d37689abe
7 changed files with 75 additions and 24 deletions

View file

@ -44,8 +44,8 @@ int my_chsize(File fd, my_off_t newlength, myf MyFlags)
my_off_t oldsize;
char buff[IO_SIZE];
bzero(buff,IO_SIZE);
oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE));
DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize));
#ifdef HAVE_FTRUNCATE
if (oldsize > newlength)
@ -64,9 +64,12 @@ int my_chsize(File fd, my_off_t newlength, myf MyFlags)
if (oldsize > newlength)
{ /* Fill diff with null */
VOID(my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE)));
swap(long, newlength, oldsize);
swap(my_off_t, newlength, oldsize);
}
#endif
/* Full file with 0 until it's as big as requested */
bzero(buff,IO_SIZE);
my_seek(fd, old_length, MY_SEEK_SET, MYF(MY_WME+MY_FAE));
while (newlength-oldsize > IO_SIZE)
{
if (my_write(fd,(byte*) buff,IO_SIZE,MYF(MY_NABP)))

View file

@ -24,8 +24,8 @@ my_off_t my_seek(File fd, my_off_t pos, int whence, myf MyFlags)
{
reg1 os_off_t newpos;
DBUG_ENTER("my_seek");
DBUG_PRINT("my",("Fd: %d Pos: %lu Whence: %d MyFlags: %d",
fd, (ulong) pos, whence, MyFlags));
DBUG_PRINT("my",("Fd: %d Hpos: %lu Pos: %lu Whence: %d MyFlags: %d",
fd, ((ulonglong) pos) >> 32, (ulong) pos, whence, MyFlags));
newpos=lseek(fd, pos, whence);
if (newpos == (os_off_t) -1)
{

View file

@ -41,7 +41,8 @@ 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)
@ -56,8 +57,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))