diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-07-19 12:38:30 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-07-19 12:38:30 +0000 |
commit | dceca5ce5559314ce26684c74b3a02f61015492c (patch) | |
tree | 676ab2ce1d7c4e738906552a4d6c4f71645f7d16 /sv.c | |
parent | 15b6a22a03c78fa80bf8e9675c0fde098d83cee8 (diff) | |
parent | 2909fa0e2236c057a14e92ab228e041ad03cd60c (diff) | |
download | perl-dceca5ce5559314ce26684c74b3a02f61015492c.tar.gz |
Merge Mainline
p4raw-id: //depot/ansiperl@1566
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -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)) { |