summaryrefslogtreecommitdiff
path: root/src/pl/plperl/plperl.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2009-06-05 20:32:58 +0000
committerAndrew Dunstan <andrew@dunslane.net>2009-06-05 20:32:58 +0000
commit1e82d5242591fbab9c92ff0ae4881dc7f163ccdc (patch)
treed253fd33d831906c1ae87f3eae82d4f93ef702ce /src/pl/plperl/plperl.c
parent279e744ddc0866054489acdb8a713eb104e1aa85 (diff)
Adjust recent PERL_SYS_INIT3 call to avoid platforms where it might fail, and to remove compilation warning. Backpatch the release 7.4
Diffstat (limited to 'src/pl/plperl/plperl.c')
-rw-r--r--src/pl/plperl/plperl.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 86d47a2f12d..a2ea1de3c53 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.67.4.9 2009/06/04 16:01:03 adunstan Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.67.4.10 2009/06/05 20:32:58 adunstan Exp $
*
**********************************************************************/
@@ -212,6 +212,8 @@ plperl_init_interp(void)
int nargs = 3;
+ char *dummy_perl_env[1] = { NULL };
+
#ifdef WIN32
/*
@@ -251,8 +253,17 @@ plperl_init_interp(void)
#endif
-#ifdef PERL_SYS_INIT3
- PERL_SYS_INIT3(&nargs, (char ***) &embedding, NULL);
+ /****
+ * The perl API docs state that PERL_SYS_INIT3 should be called before
+ * allocating interprters. Unfortunately, on some platforms this fails
+ * in the Perl_do_taint() routine, which is called when the platform is
+ * using the system's malloc() instead of perl's own. Other platforms,
+ * notably Windows, fail if PERL_SYS_INIT3 is not called. So we call it
+ * if it's available, unless perl is using the system malloc(), which is
+ * true when MYMALLOC is set.
+ */
+#if defined(PERL_SYS_INIT3) && !defined(MYMALLOC)
+ PERL_SYS_INIT3(&nargs, (char ***)&embedding, (char***)&dummy_perl_env);
#endif
plperl_interp = perl_alloc();