summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2001-01-15 17:17:43 +0200
committerunknown <monty@donna.mysql.com>2001-01-15 17:17:43 +0200
commit4d37689abeeaacb662c31d58038d2386a5228f8f (patch)
tree4264a6499afeab1b99e53f927059e5450643a435 /mysys
parent4e264107df5c286d0a06ff28699aec398e36e684 (diff)
downloadmariadb-git-4d37689abeeaacb662c31d58038d2386a5228f8f.tar.gz
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
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_chsize.c7
-rw-r--r--mysys/my_seek.c4
-rw-r--r--mysys/my_write.c17
3 files changed, 21 insertions, 7 deletions
diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c
index 1063e9381bf..fe44ff1b12e 100644
--- a/mysys/my_chsize.c
+++ b/mysys/my_chsize.c
@@ -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)))
diff --git a/mysys/my_seek.c b/mysys/my_seek.c
index 12f8ced0642..d8e8cf83b6d 100644
--- a/mysys/my_seek.c
+++ b/mysys/my_seek.c
@@ -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)
{
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 03cbec4a0d6..61d6c7d2180 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -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))