From 84d9a97a08eb3c584273de6ca57683401b6bd03f Mon Sep 17 00:00:00 2001 From: rofl0r Date: Wed, 9 Jul 2014 18:07:24 +0200 Subject: [PATCH] main.c: remove code duplication around LD_PRELOAD --- src/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index a3378d5..c67cde4 100644 --- a/src/main.c +++ b/src/main.c @@ -122,14 +122,14 @@ int main(int argc, char *argv[]) { if(!quiet) fprintf(stderr, LOG_PREFIX "preloading %s/%s\n", prefix, dll_name); -#ifndef IS_MAC - snprintf(buf, sizeof(buf), "LD_PRELOAD=%s/%s", prefix, dll_name); - putenv(buf); -#else - snprintf(buf, sizeof(buf), "DYLD_INSERT_LIBRARIES=%s/%s", prefix, dll_name); - putenv(buf); +#ifdef IS_MAC putenv("DYLD_FORCE_FLAT_NAMESPACE=1"); +#define LD_PRELOAD_ENV "DYLD_INSERT_LIBRARIES" +#else +#define LD_PRELOAD_ENV "LD_PRELOAD" #endif + snprintf(buf, sizeof(buf), LD_PRELOAD_ENV "=%s/%s", prefix, dll_name); + putenv(buf); execvp(argv[start_argv], &argv[start_argv]); perror("proxychains can't load process....");