Module: sip-router
Branch: 4.1
Commit: 8991684e94def6efa74d827753c2fe1c3e6d9d97
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8991684…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Nov 14 23:00:32 2013 +0100
app_perl: declare extern environ variable
- without it doesn't compile on darwin and it is recommended way to do
- provide some fake argc and argv to PERL_SYS_INIT3() to avoid compile
warnings
(cherry picked from commit 34ad8c295b45bc52cc5a071bf2b5651865389f94)
---
modules/app_perl/app_perl_mod.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/modules/app_perl/app_perl_mod.c b/modules/app_perl/app_perl_mod.c
index eb303ca..a27e503 100644
--- a/modules/app_perl/app_perl_mod.c
+++ b/modules/app_perl/app_perl_mod.c
@@ -72,6 +72,8 @@ sl_api_t slb;
*/
static void destroy(void);
+/* environment pointer needed to init perl interpreter */
+extern char **environ;
/*
* Module initialization function prototype
@@ -319,6 +321,9 @@ struct mi_root* perl_mi_reload(struct mi_root *cmd_tree, void *param)
static int mod_init(void) {
int ret = 0;
+ int argc = 1;
+ char *argt[] = { MOD_NAME, NULL };
+ char **argv;
if(register_mi_mod(exports.name, mi_cmds)!=0)
{
@@ -337,7 +342,8 @@ static int mod_init(void) {
return -1;
}
- PERL_SYS_INIT3(NULL, NULL, &environ);
+ argv = argt;
+ PERL_SYS_INIT3(&argc, &argv, &environ);
if ((my_perl = parser_init())) {
ret = 0;