perl: IO.xs:322: XS_IO__Poll__poll: Assertion
`PL_valid_types_PVX[((svtype)((_svpvx)->sv_flags & 0xff)) & 0xf]'
failed.
This is because NEWSV(…, 0) returns undef, with a grabage pointer in
the PV slot. This doesn't seem to matter in practice, since nothing
actually dereferences the pointer when nfds is zero, but to be safe we
should pass in _some_ valid pointer, so just use the SV* itself;
use strict;
use warnings;
-our $VERSION = "1.35";
+our $VERSION = "1.36";
XSLoader::load 'IO', $VERSION;
sub import {
#ifdef HAS_POLL
const int nfd = (items - 1) / 2;
SV *tmpsv = NEWSV(999,nfd * sizeof(struct pollfd));
- struct pollfd *fds = (struct pollfd *)SvPVX(tmpsv);
+ /* We should pass _some_ valid pointer even if nfd is zero, but it
+ * doesn't matter what it is, since we're telling it to not check any fds.
+ */
+ struct pollfd *fds = nfd ? (struct pollfd *)SvPVX(tmpsv) : (struct pollfd *)tmpsv;
int i,j,ret;
for(i=1, j=0 ; j < nfd ; j++) {
fds[j].fd = SvIV(ST(i));