diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-01-11 10:34:02 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-01-11 10:34:02 +0000 |
commit | 8b8eea963147e9111f99b4c1bf3eb8b60fe51935 (patch) | |
tree | 02d1d5a34ead7b832e79f5b342b6d6f388a65c67 /ext/PerlIO | |
parent | 3256a4f81269a0cb31d9dd71cd296e224c40dc32 (diff) | |
download | perl-8b8eea963147e9111f99b4c1bf3eb8b60fe51935.tar.gz |
Fix bug #40407: after a seek on a PerlIO::scalar filehandle,
ensure there's a string buffer in the scalar
p4raw-id: //depot/perl@29751
Diffstat (limited to 'ext/PerlIO')
-rw-r--r-- | ext/PerlIO/scalar/scalar.xs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/PerlIO/scalar/scalar.xs b/ext/PerlIO/scalar/scalar.xs index 319c85137d..b31e681c21 100644 --- a/ext/PerlIO/scalar/scalar.xs +++ b/ext/PerlIO/scalar/scalar.xs @@ -108,6 +108,10 @@ PerlIOScalar_seek(pTHX_ PerlIO * f, Off_t offset, int whence) Zero(SvPVX(s->var) + oldcur, newlen - oldcur, char); /* No SvCUR_set(), though. This is just a seek, not a write. */ } + else if (!SvPVX(s->var)) { + /* ensure there's always a character buffer */ + (void)SvGROW(s->var,1); + } SvPOK_on(s->var); return 0; } |