File ElectricFence-2.2.2.diff of Package ElectricFence
--- Makefile
+++ Makefile
@@ -5,7 +5,7 @@
prefix=/usr
BIN_INSTALL_DIR= $(prefix)/bin
LIB_INSTALL_DIR= $(prefix)/lib
-MAN_INSTALL_DIR= $(prefix)/man/man3
+MAN_INSTALL_DIR= $(prefix)/share/man/man3
CC= cc
AR= ar
--- ef.sh
+++ ef.sh
@@ -14,7 +14,4 @@
fi
# Set the environment to load eletric fence.
-(\
-export LD_PRELOAD=libefence.so.0.0;\
-exec $*;\
-)
+LD_PRELOAD=libefence.so.0.0 exec "$@"
--- efence.c
+++ efence.c
@@ -87,7 +87,7 @@
* of buffers returned by malloc(), calloc(), and realloc(). It is all-caps
* so that its name matches the name of the environment variable that is used
* to set it. This gives the programmer one less name to remember.
- * If the value is -1, it will be set from the environment or sizeof(int)
+ * If the value is -1, it will be set from the environment or sizeof(long double)
* at run time.
*/
int EF_ALIGNMENT = -1;
@@ -397,6 +397,11 @@
release();
}
+
+
+extern C_LINKAGE void *
+memalign(size_t alignment, size_t userSize);
+
/*
* allocateMoreSlots is called when there are only enough slot structures
* left to support the allocation of a single malloc buffer.
@@ -412,7 +417,7 @@
noAllocationListProtection = 1;
internalUse = 1;
- newAllocation = malloc(newSize);
+ newAllocation = memalign(0, newSize);
memcpy(newAllocation, allocationList, allocationListSize);
memset(&(((char *)newAllocation)[allocationListSize]), 0, bytesPerPage);
--- eftest.c
+++ eftest.c
@@ -24,7 +24,7 @@
extern int EF_PROTECT_BELOW;
extern int EF_ALIGNMENT;
-static jmp_buf env;
+static sigjmp_buf env;
/*
* There is still too little standardization of the arguments and return
@@ -40,13 +40,13 @@
)
{
signal(PAGE_PROTECTION_VIOLATED_SIGNAL, SIG_DFL);
- longjmp(env, 1);
+ siglongjmp(env, 1);
}
static int
gotSegmentationFault(int (*test)(void))
{
- if ( setjmp(env) == 0 ) {
+ if ( sigsetjmp(env, 1) == 0 ) {
int status;
signal(PAGE_PROTECTION_VIOLATED_SIGNAL
--- print.c
+++ print.c
@@ -111,7 +111,7 @@
break;
case 'c':
{
- char c = va_arg(args, char);
+ char c = va_arg(args, int);
(void) write(2, &c, 1);
}