summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-05-06 13:42:26 +0300
committerunknown <monty@mysql.com>2004-05-06 13:42:26 +0300
commit445148f08339db0cc32c5254f31f8629fedd2af0 (patch)
tree9a75e17ac46c0c2c536c9050f133f4319e09c69e /innobase
parentcc7a8d9bed2193dc3d424b19cac456477db6e6f5 (diff)
parent2d776e36d8dd205efccc18a75292308fd4c5d385 (diff)
downloadmariadb-git-445148f08339db0cc32c5254f31f8629fedd2af0.tar.gz
Merge with 4.0 to get security patch for check_grant_colum
innobase/include/os0file.h: Auto merged innobase/os/os0file.c: Auto merged innobase/srv/srv0srv.c: Auto merged mysql-test/r/rpl_server_id2.result: Auto merged sql/ha_innodb.cc: Auto merged sql/slave.cc: Merge with 4.0
Diffstat (limited to 'innobase')
-rw-r--r--innobase/include/os0file.h8
-rw-r--r--innobase/os/os0file.c17
-rw-r--r--innobase/srv/srv0srv.c6
3 files changed, 26 insertions, 5 deletions
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 263142db74f..3eccfcd3be5 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -358,6 +358,14 @@ os_file_set_size(
size */
ulint size_high);/* in: most significant 32 bits of size */
/***************************************************************************
+Truncates a file at its current position. */
+
+ibool
+os_file_set_eof(
+/*============*/
+ /* out: TRUE if success */
+ FILE* file); /* in: file to be truncated */
+/***************************************************************************
Flushes the write buffers of a given file to the disk. */
ibool
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index ff5b30bec0d..3f14a2158ed 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -1583,6 +1583,23 @@ error_handling:
}
/***************************************************************************
+Truncates a file at its current position. */
+
+ibool
+os_file_set_eof(
+/*============*/
+ /* out: TRUE if success */
+ FILE* file) /* in: file to be truncated */
+{
+#ifdef __WIN__
+ HANDLE h = (HANDLE) _get_osfhandle(fileno(file));
+ return(SetEndOfFile(h));
+#else /* __WIN__ */
+ return(!ftruncate(fileno(file), ftell(file)));
+#endif /* __WIN__ */
+}
+
+/***************************************************************************
Flushes the write buffers of a given file to the disk. */
ibool
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 9dffdbf2f9f..7194dfc1d2f 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -1655,11 +1655,7 @@ loop:
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
srv_printf_innodb_monitor(srv_monitor_file);
-#ifdef __WIN__
- chsize(fileno(srv_monitor_file), ftell(srv_monitor_file));
-#else /* __WIN__ */
- ftruncate(fileno(srv_monitor_file), ftell(srv_monitor_file));
-#endif /* __WIN__ */
+ os_file_set_eof(srv_monitor_file);
mutex_exit(&srv_monitor_file_mutex);
if (srv_print_innodb_tablespace_monitor