Hi Folks,
I'm the author or the Compress::Zlib module. I've had a couple of reports of
my module failing on OS X 10.2.3 that I hope someone on this forum can help
me with.
With the help of one of the bug reporters, I've narrowed the problem down to
a specific are of my test harness. Here is a thumbnail sketch of the
scenario that triggers the failure.
I have a Perl function that can take a file handle as parameter. That
filehandle needs to be passed to the zlib library, but the zlib API expects
a file descriptor, so I pass the fileno to the XSUB, thus:
sub gzopen
{
my $fh = shift ;
xs_gzopen(fileno($fh));
}
and then in XS-land
xs_gzopen(int fd)
CODE:
/* make use of fd */
And here's the problem -- once in XSUB-land, any use of "fd" fails
completely! For example if I do an lseek(fd, 0, SEEK_CUR) to find the
current offset, it returns -1 with errno of 0, which isn't particularly
helpful.
This feature has been working for years on all other platforms (icluding
older Mac systems). Anyone know if this is just a "feature" of OS-X, or is
there a way to work around it?
cheers
Paul