develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [perl #22000] AutoReply: [PATCH] Naughty sv_gets/RsRECORD bug

Thread Next
From:
Enache Adrian
Date:
April 19, 2003 10:12
Subject:
Re: [perl #22000] AutoReply: [PATCH] Naughty sv_gets/RsRECORD bug
Message ID:
20030419171218.GA974@ratsnest.hole
> I suggest this:
> 
> --- /arc/bleadperl/sv.c	Fri Apr 18 00:13:05 2003
> +++ bleadperl/sv.c	Sat Apr 19 19:08:57 2003
> @@ -6370,6 +6370,8 @@ Perl_sv_gets(pTHX_ register SV *sv, regi
>  #else
>        bytesread = PerlIO_read(fp, buffer, recsize);
>  #endif
> +      if (bytesread == -1)
> +	  return Nullch;
>        SvCUR_set(sv, bytesread += append);
>        buffer[bytesread] = '\0';
>        goto return_string_or_null;

Probably this is more correct:

--- /arc/bleadperl/sv.c	Fri Apr 18 00:13:05 2003
+++ bleadperl/sv.c	Sat Apr 19 19:08:57 2003
@@ -6370,6 +6370,8 @@ Perl_sv_gets(pTHX_ register SV *sv, regi
 #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;

Regards
Adi

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About