Re: [perl #22000] AutoReply: [PATCH] Naughty sv_gets/RsRECORD bug
Adrian M. Enache [Sat, 19 Apr 2003 20:12:18 +0000 (23:12 +0300)]
Message-ID: <20030419171218.GA974@ratsnest.hole>

p4raw-id: //depot/perl@19281

sv.c

diff --git a/sv.c b/sv.c
index 5280c08..4563809 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -6379,6 +6379,8 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append)
 #else
       bytesread = PerlIO_read(fp, buffer, recsize);
 #endif
+      if (bytesread < 0)
+         bytesread = 0;
       SvCUR_set(sv, bytesread += append);
       buffer[bytesread] = '\0';
       goto return_string_or_null;