From 12c89220373834983e236d0e49c4ab39c9ba5c9f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 11 Aug 2002 18:49:47 +0300 Subject: 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 innobase/os/os0thread.c: Fix a portability bug introduced in Windows when we changed os_thread_id_t to be the same as os_thread_t innobase/include/os0thread.h: Fix a portability bug introduced in Windows when we changed os_thread_id_t to be the same as os_thread_t innobase/srv/srv0srv.c: Add safety against buffer overruns in SHOW INNODB STATUS innobase/lock/lock0lock.c: Add safety against buffer overruns in latest deadlock info innobase/include/ut0ut.h: Redefine sprintf as ut_sprintf inside InnoDB code; some old Unixes may have a pointer as the return type of sprintf innobase/include/univ.i: Redefine sprintf as ut_sprintf inside InnoDB code; some old Unixes may have a pointer as the return type of sprintf innobase/ut/ut0ut.c: Redefine sprintf as ut_sprintf inside InnoDB code; some old Unixes may have a pointer as the return type of sprintf sql/ha_innobase.cc: Redefine sprintf as ut_sprintf inside InnoDB code; some old Unixes may have a pointer as the return type of sprintf --- innobase/ut/ut0ut.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'innobase/ut') diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index 6a5f273e731..2274e723be9 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -12,10 +12,35 @@ Created 5/11/1994 Heikki Tuuri #include "ut0ut.ic" #endif +#include + #include "ut0sort.h" ibool ut_always_false = FALSE; +/************************************************************ +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 */ +{ + va_list args; + + va_start(args, format); + + vsprintf(buf, format, args); + + va_end(args); + + return((ulint)strlen(buf)); +} + /************************************************************ 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++, -- cgit v1.2.1