summaryrefslogtreecommitdiff
path: root/ext/XS
diff options
context:
space:
mode:
authorTim Jenness <tjenness@cpan.org>2002-07-11 00:15:45 -1000
committerJarkko Hietaniemi <jhi@iki.fi>2002-07-11 19:42:35 +0000
commitc72de6e4fcf1475a6744c18dcaf8c2e06e1665bf (patch)
treefb06082cb8e3667ea45a0c8e7348e14849e6d223 /ext/XS
parentd360a069d6bdc55d9bfda16507abbff2168bf4f7 (diff)
downloadperl-c72de6e4fcf1475a6744c18dcaf8c2e06e1665bf.tar.gz
finall fix core dump in XS::Typemap
Message-ID: <Pine.LNX.4.44.0207111013090.31260-100000@lapaki> p4raw-id: //depot/perl@17492
Diffstat (limited to 'ext/XS')
-rw-r--r--ext/XS/Typemap/Typemap.t6
-rw-r--r--ext/XS/Typemap/Typemap.xs11
2 files changed, 10 insertions, 7 deletions
diff --git a/ext/XS/Typemap/Typemap.t b/ext/XS/Typemap/Typemap.t
index 0cf1ab3481..1699c991dc 100644
--- a/ext/XS/Typemap/Typemap.t
+++ b/ext/XS/Typemap/Typemap.t
@@ -314,11 +314,7 @@ if (defined $fh) {
ok(print $fh "$lines[1]");
# close it using XS
- # This works fine but causes a segmentation fault during global
- # destruction when the glob associated with this filehandle is
- # tidied up.
-# ok( T_STDIO_close( $fh ) );
- ok(close($fh)); # using perlio to close the glob works fine
+ ok( T_STDIO_close( $fh ) );
# open from perl, and check contents
open($fh, "< $testfile");
diff --git a/ext/XS/Typemap/Typemap.xs b/ext/XS/Typemap/Typemap.xs
index feed61b904..853b4abd2b 100644
--- a/ext/XS/Typemap/Typemap.xs
+++ b/ext/XS/Typemap/Typemap.xs
@@ -795,10 +795,17 @@ T_STDIO_open( file )
RETVAL
SysRet
-T_STDIO_close( stream )
- FILE * stream
+T_STDIO_close( f )
+ PerlIO * f
+ PREINIT:
+ FILE * stream;
CODE:
+ /* Get the FILE* */
+ stream = PerlIO_findFILE( f );
RETVAL = xsfclose( stream );
+ /* Release the FILE* from the PerlIO system so that we do
+ not close the file twice */
+ PerlIO_releaseFILE(f,stream);
OUTPUT:
RETVAL