diff --git a/opal/mca/memory/ptmalloc2/opal_ptmalloc2_munmap.c b/opal/mca/memory/ptmalloc2/opal_ptmalloc2_munmap.c index 0cf1de7b3a..27dd75e179 100644 --- a/opal/mca/memory/ptmalloc2/opal_ptmalloc2_munmap.c +++ b/opal/mca/memory/ptmalloc2/opal_ptmalloc2_munmap.c @@ -22,15 +22,15 @@ #include #include #if defined(HAVE___MUNMAP) -/* here so we only include dlfcn if we absolutely have to */ +/* here so we only include others if we absolutely have to */ +#elif defined(HAVE_SYSCALL) +#include +#include #elif defined(HAVE_DLSYM) #ifndef __USE_GNU #define __USE_GNU #endif #include -#elif defined(HAVE_SYSCALL) -#include -#include #endif #include "opal/memoryhooks/memory_internal.h" @@ -59,7 +59,7 @@ munmap(void* addr, size_t len) int opal_mem_free_ptmalloc2_munmap(void *start, size_t length, int from_alloc) { -#if !defined(HAVE___MUNMAP) && defined(HAVE_DLSYM) +#if !defined(HAVE___MUNMAP) && !defined(HAVE_SYSCALL) && defined(HAVE_DLSYM) static int (*realmunmap)(void*, size_t); #endif @@ -67,6 +67,8 @@ opal_mem_free_ptmalloc2_munmap(void *start, size_t length, int from_alloc) #if defined(HAVE___MUNMAP) return __munmap(start, length); +#elif defined(HAVE_SYSCALL) + return syscall(__NR_munmap, start, length); #elif defined(HAVE_DLSYM) if (NULL == realmunmap) { union { @@ -79,8 +81,6 @@ opal_mem_free_ptmalloc2_munmap(void *start, size_t length, int from_alloc) } return realmunmap(start, length); -#elif defined(HAVE_SYSCALL) - return syscall(__NR_munmap, start, length); #else #error "Can not determine how to call munmap" #endif diff --git a/opal/tools/wrappers/opal_wrapper.c b/opal/tools/wrappers/opal_wrapper.c index f0e3eb0f52..eb9d3e116c 100644 --- a/opal/tools/wrappers/opal_wrapper.c +++ b/opal/tools/wrappers/opal_wrapper.c @@ -272,7 +272,7 @@ main(int argc, char *argv[]) int exit_status = 0, ret, flags = 0, i; int exec_argc = 0, user_argc = 0; char **exec_argv = NULL, **user_argv = NULL; - char *exec_command, *base_argv0; + char *exec_command, *base_argv0 = NULL; bool disable_flags = true; bool real_flag = false; @@ -287,7 +287,7 @@ main(int argc, char *argv[]) * ****************************************************/ - base_argv0 = basename(argv[0]); + base_argv0 = strdup(basename(argv[0])); if (OPAL_SUCCESS != (ret = data_init(base_argv0))) { return ret; } @@ -511,7 +511,7 @@ main(int argc, char *argv[]) } else { char *tmp; -#if 1 +#if 0 exec_command = opal_argv_join(exec_argv, ' '); printf("command: %s\n", exec_command); #endif