This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [perl #38868] Changing $0 on darwin leads to excessive padding in 'ps'
[perl5.git] / mg.c
diff --git a/mg.c b/mg.c
index a64526e..56e8065 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2632,11 +2632,16 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
                Copy(s, PL_origargv[0], len, char);
                PL_origargv[0][len] = 0;
                memset(PL_origargv[0] + len + 1,
+#ifdef PERL_DARWIN
+                      /* Special case for darwin: see [perl #38868] */
+                      (int)'\0',
+#else
                       /* Is the space counterintuitive?  Yes.
-                       * (You were expecting \0?)  
+                       * (You were expecting \0?)
                        * Does it work?  Seems to.  (In Linux 2.4.20 at least.)
                        * --jhi */
                       (int)' ',
+#endif
                       PL_origalen - len - 1);
            }
            PL_origargv[0][PL_origalen-1] = 0;