summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2002-08-11 18:49:47 +0300
committerheikki@hundin.mysql.fi <>2002-08-11 18:49:47 +0300
commitbee3f072e40dbdd40b45de1988309fb4bb9f6546 (patch)
treed3f55dcc192a55ccc266a48e322be71aae0673af /innobase/include
parent0005f28b4ec6fdc73c83ea430f53f74103b26239 (diff)
downloadmariadb-git-bee3f072e40dbdd40b45de1988309fb4bb9f6546.tar.gz
ha_innobase.cc, ut0ut.c, univ.i, ut0ut.h:
Redefine sprintf as ut_sprintf inside InnoDB code; some old Unixes may have a pointer as the return type of sprintf lock0lock.c: Add safety against buffer overruns in latest deadlock info srv0srv.c: Add safety against buffer overruns in SHOW INNODB STATUS os0thread.h, os0thread.c: Fix a portability bug introduced in Windows when we changed os_thread_id_t to be the same as os_thread_t
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/os0thread.h4
-rw-r--r--innobase/include/univ.i6
-rw-r--r--innobase/include/ut0ut.h12
3 files changed, 21 insertions, 1 deletions
diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h
index 636cfd79e50..95a3a95fb74 100644
--- a/innobase/include/os0thread.h
+++ b/innobase/include/os0thread.h
@@ -70,7 +70,9 @@ os_thread_create(
void* arg, /* in: argument to start
function */
os_thread_id_t* thread_id); /* out: id of created
- thread */
+ thread; currently this is
+ identical to the handle to
+ the thread */
/*********************************************************************
A thread calling this function ends its execution. */
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index f5d083766bc..b511ec044a2 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -63,6 +63,12 @@ Microsoft Visual C++ */
#define HAVE_PWRITE
#endif
+/* Apparently in some old SCO Unixes the return type of sprintf is not
+an integer as it should be according to the modern Posix standard. Because
+of that we define sprintf inside InnoDB code as our own function ut_sprintf */
+#undef sprintf
+#define sprintf ut_sprintf
+
#endif
/* DEBUG VERSION CONTROL
diff --git a/innobase/include/ut0ut.h b/innobase/include/ut0ut.h
index 408788016c1..8ec23b23dcd 100644
--- a/innobase/include/ut0ut.h
+++ b/innobase/include/ut0ut.h
@@ -17,6 +17,18 @@ Created 1/20/1994 Heikki Tuuri
typedef time_t ib_time_t;
+
+/************************************************************
+Uses vsprintf to emulate sprintf so that the function always returns
+the printed length. Apparently in some old SCO Unixes sprintf did not
+return the printed length but a pointer to the end of the printed string. */
+
+ulint
+ut_sprintf(
+/*=======*/
+ char* buf, /* in/out: buffer where to print */
+ const char* format, /* in: format of prints */
+ ...); /* in: arguments to be printed */
/************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
but since there seem to be compiler bugs in both gcc and Visual C++,