From 703d5897701c22250a2d6e8ffba9ecf01db58f1f Mon Sep 17 00:00:00 2001 From: Brad Hards Date: Wed, 22 Apr 2009 10:32:53 +0200 Subject: Avoid using deprecated form of AC_CHECK_TYPE. libreplace makes use of an older form of AC_CHECK_TYPE which basically provides a fallback definition for the type if it isn't available. http://www.gnu.org/software/hello/manual/autoconf/Obsolete-Macros.html#Obsolete-Macros shows why this isn't a good idea (its not so important, except for pointer types). This patch partly addresses the issue. Signed-off-by: Jelmer Vernooij --- lib/replace/libreplace_cc.m4 | 4 +--- lib/replace/replace.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/replace/libreplace_cc.m4 b/lib/replace/libreplace_cc.m4 index 30c63f2f05..a26dee498e 100644 --- a/lib/replace/libreplace_cc.m4 +++ b/lib/replace/libreplace_cc.m4 @@ -141,9 +141,7 @@ AC_CHECK_SIZEOF(off_t) AC_CHECK_SIZEOF(size_t) AC_CHECK_SIZEOF(ssize_t) -AC_CHECK_TYPE(intptr_t, long long) -AC_CHECK_TYPE(uintptr_t, unsigned long long) -AC_CHECK_TYPE(ptrdiff_t, unsigned long long) +AC_CHECK_TYPES([intptr_t, uintptr_t, ptrdiff_t]) if test x"$ac_cv_type_long_long" != x"yes";then AC_MSG_ERROR([LIBREPLACE needs type 'long long']) diff --git a/lib/replace/replace.h b/lib/replace/replace.h index c5b8676acf..fe1f732acb 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -535,6 +535,18 @@ typedef int bool; #endif #endif +#if !defined(HAVE_INTPTR_T) +typedef long long intptr_t ; +#endif + +#if !defined(HAVE_UINTPTR_T) +typedef unsigned long long uintptr_t ; +#endif + +#if !defined(HAVE_PTRDIFF_T) +typedef unsigned long long ptrdiff_t ; +#endif + /* * to prevent from doing a redefine of 'bool' * -- cgit From b029e0edcf356772c66190af843087f14c88b3f2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 21 Apr 2009 03:08:37 -0400 Subject: Prevent reallocs of the talloc pool itself --- lib/talloc/talloc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 60a48ad811..33cbfd7d26 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -1008,6 +1008,11 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n return NULL; } + /* don't let anybody try to realloc a talloc_pool */ + if (unlikely(tc->flags & TALLOC_FLAG_POOL)) { + return NULL; + } + /* don't shrink if we have less than 1k to gain */ if ((size < tc->size) && ((tc->size - size) < 1024)) { tc->size = size; -- cgit