summaryrefslogtreecommitdiff
path: root/mysys/my_chsize.c
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-11-04 22:55:47 +0100
committerunknown <serg@serg.mylan>2004-11-04 22:55:47 +0100
commitcce44b148c88be9cecf4e4976d39d16f779cebb7 (patch)
tree456c036521147621fa4c793dba96906b5aca5102 /mysys/my_chsize.c
parentfac533bb14bf2fd32edafb0d1d2792dd33d403de (diff)
downloadmariadb-git-cce44b148c88be9cecf4e4976d39d16f779cebb7.tar.gz
mmap portability layer, mmap for Windows
new macro: thread_safe_decrement, thread_safe_dec_and_test, statistic_decrement mysys/my_chsize.c: cleanup include/config-win.h: mmap portability layer, mmap for Windows include/my_pthread.h: thread_safe_decrement, thread_safe_dec_and_test, statistic_decrement include/my_sys.h: mmap portability layer, mmap for Windows mysys/Makefile.am: mmap portability layer, mmap for Windows
Diffstat (limited to 'mysys/my_chsize.c')
-rw-r--r--mysys/my_chsize.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c
index cf26428d65f..c258121226d 100644
--- a/mysys/my_chsize.c
+++ b/mysys/my_chsize.c
@@ -48,9 +48,9 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize));
if (oldsize > newlength)
+ {
#if defined(HAVE_SETFILEPOINTER)
/* This is for the moment only true on windows */
- {
long is_success;
HANDLE win_file= (HANDLE) _get_osfhandle(fd);
long length_low, length_high;
@@ -63,35 +63,29 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
DBUG_RETURN(0);
my_errno= GetLastError();
goto err;
- }
#elif defined(HAVE_FTRUNCATE)
- {
if (ftruncate(fd, (off_t) newlength))
{
my_errno= errno;
goto err;
}
DBUG_RETURN(0);
- }
#elif defined(HAVE_CHSIZE)
- {
if (chsize(fd, (off_t) newlength))
{
my_errno=errno;
goto err;
}
DBUG_RETURN(0);
- }
#else
- {
/*
Fill space between requested length and true length with 'filler'
We should never come here on any modern machine
*/
VOID(my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE)));
swap_variables(my_off_t, newlength, oldsize);
- }
#endif
+ }
/* Full file with 'filler' until it's as big as requested */
bfill(buff, IO_SIZE, filler);