setproctitle() made simpler. (This assumes the string is
Jarkko Hietaniemi [Thu, 2 Aug 2001 13:18:08 +0000 (13:18 +0000)]
\0-terminated: if not, the three-arg form setproctitle(fmt, len, s)
should be used.  Note len, not len + 1.)  BSD-fu from Anton
Berezin.

p4raw-id: //depot/perl@11548

mg.c

diff --git a/mg.c b/mg.c
index f3fc035..d517cc5 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2089,7 +2089,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
             * but not the "(perl) suffix from the ps(1)
             * output, because that's what ps(1) shows if the
             * argv[] is modified. */
-           setproctitle("-%s", s, len + 1);
+           setproctitle("-%s", s);
 #   else       /* old FreeBSDs, NetBSD, OpenBSD, anyBSD */
            /* This doesn't really work if you assume that
             * $0 = 'foobar'; will wipe out 'perl' from the $0