From e42bc2c1c3de8b65d7f416956de0ed1ee9c6e489 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 4 Jun 2019 02:14:20 +0200 Subject: [PATCH] efl proc/exe envrion work again - after a break earlier on freebsd efl seemingly has been broken on freebsd for a while - environ the symbol does not exist for SHARED LIBS on freebsd (discussin had been had on this already, but i gave up). use dlsym as the escape mechanism so we build on freebsd again. --- src/lib/ecore/efl_core_proc_env.c | 23 +++++++++++++++++++++-- src/lib/ecore/efl_exe.c | 11 +++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore/efl_core_proc_env.c b/src/lib/ecore/efl_core_proc_env.c index 4c02821..76f3bd1 100644 --- a/src/lib/ecore/efl_core_proc_env.c +++ b/src/lib/ecore/efl_core_proc_env.c @@ -13,7 +13,12 @@ #define MY_CLASS EFL_CORE_PROC_ENV_CLASS +#if defined (__FreeBSD__) || defined (__OpenBSD__) +# include +static char ***_dl_environ; +#else extern char **environ; +#endif static Efl_Core_Env *env = NULL; @@ -27,6 +32,7 @@ _sync(Efl_Core_Env *obj, Efl_Core_Proc_Env_Data *pd) Eina_List *existing_keys = NULL, *n; Eina_Iterator *content; const char *key; + char **env = NULL; pd->in_sync = EINA_TRUE; content = efl_core_env_content_get(obj); @@ -36,11 +42,18 @@ _sync(Efl_Core_Env *obj, Efl_Core_Proc_Env_Data *pd) existing_keys = eina_list_append(existing_keys, key); } - if (environ) +#if defined (__FreeBSD__) || defined (__OpenBSD__) + _dl_environ = dlsym(NULL, "environ"); + if (_dl_environ) env = *_dl_environ; + else ERR("Can't find envrion symbol"); +#else + env = environ; +#endif + if (env) { char **p; - for (p = environ; *p; p++) + for (p = env; *p; p++) { char **values; @@ -104,7 +117,13 @@ _efl_core_proc_env_efl_core_env_clear(Eo *obj, Efl_Core_Proc_Env_Data *pd) #ifdef HAVE_CLEARENV clearenv(); #else +# if defined (__FreeBSD__) || defined (__OpenBSD__) + _dl_environ = dlsym(NULL, "environ"); + if (_dl_environ) *_dl_environ = NULL; + else ERR("Can't find envrion symbol"); +# else environ = NULL; +# endif #endif } } diff --git a/src/lib/ecore/efl_exe.c b/src/lib/ecore/efl_exe.c index b7cba72..75cba04 100644 --- a/src/lib/ecore/efl_exe.c +++ b/src/lib/ecore/efl_exe.c @@ -30,7 +30,12 @@ # include # endif # ifndef HAVE_CLEARENV +# if defined (__FreeBSD__) || defined (__OpenBSD__) +# include +static char ***_dl_environ; +# else extern char **environ; +# endif # endif #endif @@ -579,7 +584,13 @@ _efl_exe_efl_task_run(Eo *obj, Efl_Exe_Data *pd) # ifdef HAVE_CLEARENV clearenv(); # else +# if defined (__FreeBSD__) || defined (__OpenBSD__) + _dl_environ = dlsym(NULL, "environ"); + if (_dl_environ) *_dl_environ = NULL; + else ERR("Can't find envrion symbol"); +# else environ = NULL; +# endif # endif itr = efl_core_env_content_get(pd->env); -- 2.7.4