summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1998-07-19 12:38:30 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1998-07-19 12:38:30 +0000
commita15299417de39f35d2ce17e6891b4f961265fb6a (patch)
tree676ab2ce1d7c4e738906552a4d6c4f71645f7d16 /sv.c
parent911d147d409bfec728014bf1ae544556d9e97f28 (diff)
parentbdda3fbd757cd1d51073d4e041d25f173c8b2f82 (diff)
downloadperl-a15299417de39f35d2ce17e6891b4f961265fb6a.tar.gz
Merge Mainline
p4raw-id: //depot/ansiperl@1566
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sv.c b/sv.c
index c44b424b8b..db77f72d09 100644
--- a/sv.c
+++ b/sv.c
@@ -3239,12 +3239,7 @@ sv_gets(register SV *sv, register PerlIO *fp, I32 append)
/* Grab the size of the record we're getting */
recsize = SvIV(SvRV(PL_rs));
(void)SvPOK_only(sv); /* Validate pointer */
- /* Make sure we've got the room to yank in the whole thing */
- if (SvLEN(sv) <= recsize + 3) {
- /* No, so make it bigger */
- SvGROW(sv, recsize + 3);
- }
- buffer = SvPVX(sv); /* Get the location of the final buffer */
+ buffer = SvGROW(sv, recsize + 1);
/* Go yank in */
#ifdef VMS
/* VMS wants read instead of fread, because fread doesn't respect */
@@ -3255,6 +3250,7 @@ sv_gets(register SV *sv, register PerlIO *fp, I32 append)
bytesread = PerlIO_read(fp, buffer, recsize);
#endif
SvCUR_set(sv, bytesread);
+ buffer[bytesread] = '\0';
return(SvCUR(sv) ? SvPVX(sv) : Nullch);
}
else if (RsPARA(PL_rs)) {