This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
setting $0 still broken
authorJan Dubois <jand@activestate.com>
Thu, 27 Nov 2003 21:09:51 +0000 (13:09 -0800)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 2 Dec 2003 21:34:57 +0000 (21:34 +0000)
Message-ID: <f3mdsv8dcv4asle0kbhiijk0adu1l25sr3@4ax.com>

p4raw-id: //depot/perl@21833

mg.c

diff --git a/mg.c b/mg.c
index 92aa03f..efdd61e 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2408,7 +2408,6 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
            /* Longer than original, will be truncated. We assume that
              * PL_origalen bytes are available. */
            Copy(s, PL_origargv[0], PL_origalen-1, char);
-           PL_origargv[0][PL_origalen-1] = 0;
        }
        else {
            /* Shorter than original, will be padded. */
@@ -2421,9 +2420,10 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
                    * --jhi */
                   (int)' ',
                   PL_origalen - len - 1);
-           for (i = 1; i < PL_origargc; i++)
-                PL_origargv[i] = 0;
        }
+       PL_origargv[0][PL_origalen-1] = 0;
+       for (i = 1; i < PL_origargc; i++)
+           PL_origargv[i] = 0;
        UNLOCK_DOLLARZERO_MUTEX;
        break;
 #endif