diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2009-06-05 20:32:27 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2009-06-05 20:32:27 +0000 |
commit | 1236e18563b7283936e22dd74abb6195e54b0ed9 (patch) | |
tree | 4dc90ca3e2ccf1e5d8d6425971adca5a1eaf6e3e /src | |
parent | f5f3d1440a6f152859d601ee3c9230835d0dcc4f (diff) | |
download | postgresql-1236e18563b7283936e22dd74abb6195e54b0ed9.tar.gz postgresql-1236e18563b7283936e22dd74abb6195e54b0ed9.zip |
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')
-rw-r--r-- | src/pl/plperl/plperl.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 8937e2ddbc9..d8edde2fdf4 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1,7 +1,7 @@ /********************************************************************** * plperl.c - perl as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.123.2.5 2009/06/04 16:00:33 adunstan Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.123.2.6 2009/06/05 20:32:27 adunstan Exp $ * **********************************************************************/ @@ -382,6 +382,8 @@ plperl_init_interp(void) int nargs = 3; + char *dummy_perl_env[1] = { NULL }; + #ifdef WIN32 /* @@ -424,10 +426,19 @@ plperl_init_interp(void) save_time = loc ? pstrdup(loc) : NULL; #endif -#ifdef PERL_SYS_INIT3 + /**** + * 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) /* only call this the first time through, as per perlembed man page */ if (interp_state == INTERP_NONE) - PERL_SYS_INIT3(&nargs, (char ***) &embedding, NULL); + PERL_SYS_INIT3(&nargs, (char ***)&embedding, (char***)&dummy_perl_env); #endif plperl_held_interp = perl_alloc(); |