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