From a8864c48c150e609cf3cf736d0993cbff9202116 Mon Sep 17 00:00:00 2001 From: Jarod Wilson Date: Tue, 2 Jan 2007 17:06:52 +0000 Subject: [PATCH] Add patch to fix crash w/long error strings (upstream changesets 929 and 935) --- rrdtool-1.2.15-long_error_string.patch | 35 ++++++++++++++++++++++++++ rrdtool.spec | 8 +++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 rrdtool-1.2.15-long_error_string.patch diff --git a/rrdtool-1.2.15-long_error_string.patch b/rrdtool-1.2.15-long_error_string.patch new file mode 100644 index 0000000..32d6506 --- /dev/null +++ b/rrdtool-1.2.15-long_error_string.patch @@ -0,0 +1,35 @@ +Index: rrdtool/src/rrd_not_thread_safe.c +=================================================================== +--- rrdtool/src/rrd_not_thread_safe.c (revision 860) ++++ rrdtool/src/rrd_not_thread_safe.c (revision 935) +@@ -15,18 +15,24 @@ + #define ERRBUFLEN 256 + +-static char rrd_error[MAXLEN] = "\0"; +-static char rrd_liberror[ERRBUFLEN] = "\0"; ++static char rrd_error[MAXLEN+10]; ++static char rrd_liberror[ERRBUFLEN+10]; ++static int rrd_context_init = 0; + /* The global context is very useful in the transition period to even + more thread-safe stuff, it can be used whereever we need a context + and do not need to worry about concurrency. */ + static struct rrd_context global_ctx = { +- sizeof(rrd_error), +- sizeof(rrd_liberror), ++ MAXLEN, ++ ERRBUFLEN, + rrd_error, + rrd_liberror + }; +-#include ++/* #include */ + +-struct rrd_context *rrd_get_context() { ++struct rrd_context *rrd_get_context(void) { ++ if (! rrd_context_init ){ ++ rrd_context_init = 1; ++ global_ctx.rrd_error[0]='\0'; ++ global_ctx.lib_errstr[0]='\0'; ++ } + return &global_ctx; + } diff --git a/rrdtool.spec b/rrdtool.spec index 5c1ce25..864cf97 100644 --- a/rrdtool.spec +++ b/rrdtool.spec @@ -7,7 +7,7 @@ Summary: Round Robin Database Tool to store and display time-series data Name: rrdtool Version: 1.2.15 -Release: 8%{?dist} +Release: 9%{?dist} License: GPL Group: Applications/Databases URL: http://people.ee.ethz.ch/~oetiker/webtools/%{name}/ @@ -16,6 +16,7 @@ Source1: php4-svn%{php_rrd_svn}.tar.gz Patch0: rrdtool-1.2.13-php.patch Patch1: rrdtool-1.2.15-initrrdtool.patch Patch2: rrdtool-1.2.15-log_grid_leak.patch +Patch3: rrdtool-1.2.15-long_error_string.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gcc-c++, openssl-devel, freetype-devel BuildRequires: libpng-devel, zlib-devel, libart_lgpl-devel >= 2.0 @@ -114,6 +115,7 @@ The %{name}-tcl package includes RRDtool bindings for Tcl. %endif %patch1 -p1 -b .initrrdtool %patch2 -p1 -b .leak +%patch3 -p1 -b .longstring # Fix to find correct python dir on lib64 %{__perl} -pi -e 's|get_python_lib\(0,0,prefix|get_python_lib\(1,0,prefix|g' \ @@ -272,6 +274,10 @@ find examples/ -type f -exec chmod 0644 {} \; %endif %changelog +* Tue Jan 02 2007 Jarod Wilson 1.2.15-9 +- Fix crash with long error strings (upstream + changesets 929 and 935) + * Thu Dec 14 2006 Jarod Wilson 1.2.15-8 - Fix for log grid memory leak (#201241)