summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorJohn Gardiner Myers <jgmyers@proofpoint.com>2013-07-29 15:33:09 +1000
committerTony Cook <tony@develop-help.com>2013-07-29 15:33:47 +1000
commit6136213b81ecb05d74939be5083ddfdc96aef566 (patch)
tree2095dac9075d771890cbbefc0ff110b5cfbaa885 /perl.c
parent2e06b51cf21f0d70a782e77099e579ac30d69d3b (diff)
downloadperl-6136213b81ecb05d74939be5083ddfdc96aef566.tar.gz
[perl #52000] Warn/abort on attempted perl exit
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index 57d51e6f3e..f31c1ed728 100644
--- a/perl.c
+++ b/perl.c
@@ -4950,6 +4950,14 @@ void
Perl_my_exit(pTHX_ U32 status)
{
dVAR;
+ if (PL_exit_flags & PERL_EXIT_ABORT) {
+ abort();
+ }
+ if (PL_exit_flags & PERL_EXIT_WARN) {
+ PL_exit_flags |= PERL_EXIT_ABORT; /* Protect against reentrant calls */
+ Perl_warn(aTHX_ "Unexpected exit %u", status);
+ PL_exit_flags &= ~PERL_EXIT_ABORT;
+ }
switch (status) {
case 0:
STATUS_ALL_SUCCESS;
@@ -5047,6 +5055,14 @@ Perl_my_failure_exit(pTHX)
STATUS_UNIX_SET(255);
}
#endif
+ if (PL_exit_flags & PERL_EXIT_ABORT) {
+ abort();
+ }
+ if (PL_exit_flags & PERL_EXIT_WARN) {
+ PL_exit_flags |= PERL_EXIT_ABORT; /* Protect against reentrant calls */
+ Perl_warn(aTHX_ "Unexpected exit failure %u", PL_statusvalue);
+ PL_exit_flags &= ~PERL_EXIT_ABORT;
+ }
my_exit_jump();
}