This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
XS-Typemap/t/Typemap.t: avoid close warnings
authorDavid Mitchell <davem@iabyn.com>
Fri, 12 Dec 2014 19:52:53 +0000 (19:52 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 12 Dec 2014 19:52:53 +0000 (19:52 +0000)
commit906138908fccbd2b1d67430c2437155f0fa8e5c2
treeafeeb03c40d02a2c7e977e3a2e0d76da72f30757
parent50e5165b9638b94be310f15477b42935c79e82d5
XS-Typemap/t/Typemap.t: avoid close warnings

This test creates some file handles and dups them using XS that
exercises the T_OUT etc typemaps. When the dup filehandle is implicitly
closed on scope exit, it warns, since the close fails:

    Warning: unable to close filehandle properly: Bad file descriptor

The close fails because the two file handles are sharing the same
underlying IoIFP/IoOFP and so the second of the two closes doesn't work.

Fix this by explicitly closing the handles.

(Note that until the previous commit that fixed a leak with these
typemaps, the warning wasn't coming  until global destruction, since the
new GV was being leaked.)
ext/XS-Typemap/t/Typemap.t