aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-09-20 02:35:25 -0400
committerMike Frysinger <vapier@gentoo.org>2015-09-20 02:35:25 -0400
commit7e7a7a025dd2d43daf0b8ca14135e14bcaf871ce (patch)
treead5f7802ea6fd9a313fa7d5bba7992797f89a7c2
parentbuild: do not let gcc rewrite memory calls (diff)
downloadsandbox-7e7a7a025dd2d43daf0b8ca14135e14bcaf871ce.tar.gz
sandbox-7e7a7a025dd2d43daf0b8ca14135e14bcaf871ce.tar.bz2
sandbox-7e7a7a025dd2d43daf0b8ca14135e14bcaf871ce.zip
libsbutil: undef memory redirect calls
Sometimes the C library will redirect a call to strdup to __strdup which breaks when we're using the libsandbox memory allocator. This was fixed in libsandbox in commit d7801453aced46a6f31d8455877edeb31a5211cc, but we didn't notice in libsbutil as no calls to strdup happened to come up. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--libsbutil/sb_memory.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsbutil/sb_memory.c b/libsbutil/sb_memory.c
index bdc054f..ebc1c8e 100644
--- a/libsbutil/sb_memory.c
+++ b/libsbutil/sb_memory.c
@@ -11,6 +11,12 @@
#include "headers.h"
#include "sbutil.h"
+/* Make sure the C library doesn't rewrite calls to funcs libsandbox provides. */
+#undef calloc
+#undef malloc
+#undef realloc
+#undef strdup
+
void *
__xcalloc(size_t nmemb, size_t size, const char *file, const char *func, size_t line)
{