summaryrefslogtreecommitdiff
path: root/mysys/my_chsize.c
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-10-15 21:41:13 +0300
committerunknown <monty@mashka.mysql.fi>2003-10-15 21:41:13 +0300
commitb06eb4d81a82be2a215e8b9b726d214c559e3f40 (patch)
tree1cffa0627ab98f85815d577bb2824198ce5de99b /mysys/my_chsize.c
parent48446c0f73a99f7cb6a1f00700e6ea066ed28984 (diff)
downloadmariadb-git-b06eb4d81a82be2a215e8b9b726d214c559e3f40.tar.gz
Better fix for CREATE TABLE IF NOT EXISTS ... SELECT
Fixed chsize() problem on windows Extend default timeout on windows clients to 1 year (to avoid timeout problems) include/mysql.h: Added client timeouts (for TCP/IP) libmysql/libmysql.c: Added client timeouts (for TCP/IP) mysql-test/r/create.result: More tests for CREATE TABLE IF NOT EXISTS ... SELECT mysql-test/t/create.test: More tests for CREATE TABLE IF NOT EXISTS ... SELECT mysys/my_chsize.c: Fix for windows sql/handler.h: Remove not used field 'if_not_exists' Ordered fields to be more optimized for new CPU's Added field 'table_existed' sql/slave.cc: Cleanup temporary tables when slave ends sql/sql_class.h: Remove not used 'do_not_drop' field sql/sql_insert.cc: Better fix for CREATE TABLE IF NOT EXISTS ... SELECT sql/sql_table.cc: Better fix for CREATE TABLE IF NOT EXISTS ... SELECT
Diffstat (limited to 'mysys/my_chsize.c')
-rw-r--r--mysys/my_chsize.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c
index 8e46b0808c0..653ea569172 100644
--- a/mysys/my_chsize.c
+++ b/mysys/my_chsize.c
@@ -51,16 +51,17 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
#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;
length_low= (long) (ulong) newlength;
length_high= (long) ((ulonglong) newlength >> 32);
- if (SetFilePointer(win_file, length_low, &length_high, FILE_BEGIN))
- {
- if (SetEndOfFile(win_file))
- DBUG_RETURN(0);
- }
- my_errno= errno;
+ is_success= SetFilePointer(win_file, length_low, &length_high, FILE_BEGIN);
+ if (is_success == -1 && (my_errno= GetLastError()) != NO_ERROR)
+ goto err;
+ if (SetEndOfFile(win_file))
+ DBUG_RETURN(0);
+ my_errno= GetLastError();
goto err;
}
#elif defined(HAVE_FTRUNCATE)