Change 29808 by [EMAIL PROTECTED] on 2007/01/14 13:22:20
Integrate:
[ 26946]
SvREADONLY_off inside the magic routines is also dangerous on shared
hash key scalars, so decompose them to normal scalars if they ever
get here.
[ 26954]
Simplify nested '#ifdef' by replacing it with '#elif defined()'
Affected files ...
... //depot/maint-5.8/perl/mg.c#122 integrate
Differences ...
==== //depot/maint-5.8/perl/mg.c#122 (text) ====
Index: perl/mg.c
--- perl/mg.c#121~29806~ 2007-01-14 04:49:30.000000000 -0800
+++ perl/mg.c 2007-01-14 05:22:20.000000000 -0800
@@ -93,6 +93,10 @@
{
MGS* mgs;
assert(SvMAGICAL(sv));
+ /* Turning READONLY off for a copy-on-write scalar (including shared
+ hash keys) is a bad idea. */
+ if (SvIsCOW(sv))
+ sv_force_normal_flags(sv, 0);
SAVEDESTRUCTOR_X(S_restore_magic, INT2PTR(void*, (IV)mgs_ix));
@@ -675,15 +679,14 @@
break;
case '\005': /* ^E */
if (nextchar == '\0') {
-#ifdef MACOS_TRADITIONAL
+#if defined(MACOS_TRADITIONAL)
{
char msg[256];
sv_setnv(sv,(double)gMacPerl_OSErr);
sv_setpv(sv, gMacPerl_OSErr ? GetSysErrText(gMacPerl_OSErr,
msg) : "");
}
-#else
-#ifdef VMS
+#elif defined(VMS)
{
# include <descrip.h>
# include <starlet.h>
@@ -695,8 +698,7 @@
else
sv_setpvn(sv,"",0);
}
-#else
-#ifdef OS2
+#elif defined(OS2)
if (!(_emx_env & 0x200)) { /* Under DOS */
sv_setnv(sv, (NV)errno);
sv_setpv(sv, errno ? Strerror(errno) : "");
@@ -709,8 +711,7 @@
sv_setnv(sv, (NV)Perl_rc);
sv_setpv(sv, os2error(Perl_rc));
}
-#else
-#ifdef WIN32
+#elif defined(WIN32)
{
DWORD dwErr = GetLastError();
sv_setnv(sv, (NV)dwErr);
@@ -729,9 +730,6 @@
errno = saveerrno;
}
#endif
-#endif
-#endif
-#endif
SvRTRIM(sv);
SvNOK_on(sv); /* what a wonderful hack! */
}
End of Patch.