summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-10-15 21:50:36 +0300
committerunknown <monty@mashka.mysql.fi>2003-10-15 21:50:36 +0300
commit0fc97bc9e5c6c0a4f380841b325f6f0647a90bb5 (patch)
tree0ad2e2381b4b10b0164a94b12e0b415c002896dc /mysys
parente115c1f46d5007e9bd4abfdd2f2214e7ba7f9428 (diff)
parentb06eb4d81a82be2a215e8b9b726d214c559e3f40 (diff)
downloadmariadb-git-0fc97bc9e5c6c0a4f380841b325f6f0647a90bb5.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mashka.mysql.fi:/home/my/mysql-4.0
Diffstat (limited to 'mysys')
-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)