Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 33 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 magnus 1
#! /bin/sh
2
## 12_perl_init.dpatch by Magnus Holmgren <holmgren@debian.org>
3
##
4
## DP: Properly call PERL_SYS_INIT() and PERL_SYS_TERM().
5
## DP: Credit to Niko Tyni <ntyni@debian.org>.
6
 
7
FILE=src/modules/Perl/configure
8
 
9
dpatch_patch() {
36 magnus 10
    [ ! -e ${FILE}.dp-orig ] || return 1
33 magnus 11
 
36 magnus 12
    sed -i.dp-orig -f - ${FILE} <<'END_SED'
33 magnus 13
/my_perl = perl_alloc();/i\
14
  PERL_SYS_INIT3(&argc,&argv,&env);
15
/perl_free(my_perl);/a\
16
  PERL_SYS_TERM();
17
END_SED
18
 
19
    patch -p1 $*
20
 
21
}
22
 
23
dpatch_unpatch() {
36 magnus 24
    patch -p1 -R $* && [ -e ${FILE}.dp-orig ] && mv -f ${FILE}.dp-orig ${FILE}
33 magnus 25
 
26
}
27
 
28
 
29
DPATCH_LIB_NO_DEFAULT=1
30
 
31
. /usr/share/dpatch/dpatch.lib.sh
32
 
33
exit
34
 
35
@DPATCH@
36
--- 7.6-stable~/src/modules/Perl/perlmod.c	2004-04-15 02:11:26.000000000 +0200
37
+++ 7.6-stable/src/modules/Perl/perlmod.c	2008-06-16 22:50:54.000000000 +0200
38
@@ -235,6 +235,7 @@
39
 }
40
 
41
 static char *dummyargv[] = { "perl", "-e", "1", 0 };
42
+static int dummyargc = 3;
43
 
44
 static void init_perl_glue(struct object *o)
45
 {
46
@@ -263,6 +264,9 @@
47
     return;
48
   }
49
 #endif
50
+  if (num_perl_interpreters == 0)
51
+    PERL_SYS_INIT(&dummyargc, &dummyargv);
52
+
53
   MT_PERMIT;
54
   ps->perl = perl_alloc();
55
   PL_perl_destruct_level=2;
56
@@ -334,6 +338,8 @@
57
     perl_free(ps->perl);
58
     MT_FORBID;
59
     num_perl_interpreters--;
60
+    if (num_perl_interpreters == 0)
61
+      PERL_SYS_TERM();
62
   }
63
   _free_arg_and_env();
64
 }