This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In pp_getlogin, use sv_setpv_mg() to avoid needing an explicit strlen() call.
[perl5.git] / pp_sys.c
index ed4ec13..39daad6 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -5517,7 +5517,8 @@ PP(pp_getlogin)
     EXTEND(SP, 1);
     if (!(tmps = PerlProc_getlogin()))
        RETPUSHUNDEF;
-    PUSHp(tmps, strlen(tmps));
+    sv_setpv_mg(TARG, tmps);
+    PUSHs(TARG);
     RETURN;
 #else
     DIE(aTHX_ PL_no_func, "getlogin");