Rev 36 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#! /bin/sh
## 12_perl_init.dpatch by Magnus Holmgren <holmgren@debian.org>
##
## DP: Properly call PERL_SYS_INIT() and PERL_SYS_TERM().
## DP: Credit to Niko Tyni <ntyni@debian.org>.
FILE=src/modules/Perl/configure
dpatch_patch() {
[ ! -e ${FILE}.bak ] || return 1
sed -i.bak -f - ${FILE} <<'END_SED'
/my_perl = perl_alloc();/i\
PERL_SYS_INIT3(&argc,&argv,&env);
/perl_free(my_perl);/a\
PERL_SYS_TERM();
END_SED
patch -p1 $*
}
dpatch_unpatch() {
patch -p1 -R $* && [ -e ${FILE}.bak ] && mv -f ${FILE}.bak ${FILE}
}
DPATCH_LIB_NO_DEFAULT=1
. /usr/share/dpatch/dpatch.lib.sh
exit
@DPATCH@
--- 7.6-stable~/src/modules/Perl/perlmod.c 2004-04-15 02:11:26.000000000 +0200
+++ 7.6-stable/src/modules/Perl/perlmod.c 2008-06-16 22:50:54.000000000 +0200
@@ -235,6 +235,7 @@
}
static char *dummyargv[] = { "perl", "-e", "1", 0 };
+static int dummyargc = 3;
static void init_perl_glue(struct object *o)
{
@@ -263,6 +264,9 @@
return;
}
#endif
+ if (num_perl_interpreters == 0)
+ PERL_SYS_INIT(&dummyargc, &dummyargv);
+
MT_PERMIT;
ps->perl = perl_alloc();
PL_perl_destruct_level=2;
@@ -334,6 +338,8 @@
perl_free(ps->perl);
MT_FORBID;
num_perl_interpreters--;
+ if (num_perl_interpreters == 0)
+ PERL_SYS_TERM();
}
_free_arg_and_env();
}