[perl #72729] Truncate sv_gets(sv) only when not appending to a string
authorJosh ben Jore <jjore@cpan.org>
Thu, 15 Jul 2010 05:02:28 +0000 (22:02 -0700)
committerJosh ben Jore <jjore@cpan.org>
Thu, 15 Jul 2010 05:55:55 +0000 (22:55 -0700)
sv.c

diff --git a/sv.c b/sv.c
index a069b09..f555fc1 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -7086,7 +7086,9 @@ Perl_sv_gets(pTHX_ register SV *const sv, register PerlIO *const fp, I32 append)
     }
 
     SvPOK_only(sv);
-    SvCUR_set(sv,0);
+    if (!append) {
+        SvCUR_set(sv,0);
+    }
     if (PerlIO_isutf8(fp))
        SvUTF8_on(sv);