summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-05-03 04:52:09 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-05-03 04:52:09 +0000
commit58f1856e573b4625770ae64ce5ffb8ff06dc461f (patch)
tree1b7b1aa0a9697afeb184a4634b13a28f661ea015 /sv.c
parent2347ae6c7f592dfae9dd8c4fdd43c29a77207bf3 (diff)
downloadperl-58f1856e573b4625770ae64ce5ffb8ff06dc461f.tar.gz
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
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index 7668155566..05e999b7cc 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));
}
}