summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorTodd Rinaldo <toddr@cpan.org>2020-01-30 11:53:31 -0600
committerTodd Rinaldo <toddr@cpan.org>2020-02-04 13:32:37 -0600
commit92d4124ba4c1d1465a3a7cd6ae35bb0ad116b073 (patch)
tree1427fddfc0334132cd9162dbfed1ecc3a3096806 /mg.c
parent34d254cefc451e5ab438acf22a51d7b557c05a0e (diff)
downloadperl-92d4124ba4c1d1465a3a7cd6ae35bb0ad116b073.tar.gz
Pass the canonical signal name to the signal handler when it is invoked.
Prior to this change, when a signal handler was invoked, the signame passed into the sub would be the name of the signal that was defined first via {}. This meant that the handler had to either be aware of the duplicates and handle things appropriately or it would be at the mercy of action at a distance the handler might be unaware of. This change assures a consistent signal name for now on. It should be the first signal listed in $Config{sig_name}. Duplicates are listed at the end.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index 37d734ddd1..cd1f57de5a 100644
--- a/mg.c
+++ b/mg.c
@@ -1753,7 +1753,8 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
Ideally we'd find some way of making SVs at (C) compile time, or
at least, doing most of the work. */
if (!PL_psig_name[i]) {
- PL_psig_name[i] = newSVpvn(s, len);
+ const char* name = PL_sig_name[i];
+ PL_psig_name[i] = newSVpvn(name, strlen(name));
SvREADONLY_on(PL_psig_name[i]);
}
} else {