From: Jarkko Hietaniemi Date: Sat, 3 May 2003 04:52:09 +0000 (+0000) Subject: Tru64: PerlIO_tell() was returning about one _megabyte_ for X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=58f1856e573b4625770ae64ce5ffb8ff06dc461f;p=p5sagit%2Fp5-mst-13.2.git Tru64: PerlIO_tell() was returning about one _megabyte_ for the fp offset, which was quite a big larger than the input file, which meant that the SvGROW tried to grow the file to about 2**64-2**20, which made safesysrealloc() to understandably croak (in argv.t). p4raw-id: //depot/perl@19390 --- diff --git a/sv.c b/sv.c index 7668155..05e999b 100644 --- a/sv.c +++ b/sv.c @@ -6354,7 +6354,7 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append) Stat_t st; if (!PerlLIO_fstat(PerlIO_fileno(fp), &st) && S_ISREG(st.st_mode)) { Off_t offset = PerlIO_tell(fp); - if (offset != (Off_t) -1) { + if (offset != (Off_t) -1 && st.st_size + append > offset) { (void) SvGROW(sv, (STRLEN)((st.st_size - offset) + append + 1)); } }