summaryrefslogtreecommitdiff
path: root/ext/IO
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-02-05 04:37:26 +1200
committerChip Salzenberg <chip@atlantic.net>1997-05-16 10:15:00 +1200
commitfefb19804f3b755117d0936d5a943a08ec9f6cab (patch)
tree13448b08aadfa4f62da610193e2abd418593ec9e /ext/IO
parent1f4739df3b104a71e91e8f6e96c33e6309e06d36 (diff)
downloadperl-fefb19804f3b755117d0936d5a943a08ec9f6cab.tar.gz
Fix core dump on IO::Seekable::setpos($fh, undef)
Diffstat (limited to 'ext/IO')
-rw-r--r--ext/IO/IO.xs7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs
index 5efbf24815..2eb16f40ec 100644
--- a/ext/IO/IO.xs
+++ b/ext/IO/IO.xs
@@ -106,11 +106,12 @@ fsetpos(handle, pos)
InputStream handle
SV * pos
CODE:
- if (handle)
+ char *p;
+ if (handle && (p = SvPVx(pos, na)) && na == sizeof(Fpos_t))
#ifdef PerlIO
- RETVAL = PerlIO_setpos(handle, (Fpos_t*)SvPVX(pos));
+ RETVAL = PerlIO_setpos(handle, (Fpos_t*)p);
#else
- RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos));
+ RETVAL = fsetpos(handle, (Fpos_t*)p);
#endif
else {
RETVAL = -1;