- Avoid pushing C NULLs into AV.

References:	https://rt.cpan.org/Public/Bug/Display.html?id=50112
Reported by:	tobez
This commit is contained in:
Jun Kuriyama 2009-10-04 15:28:36 +00:00
parent e2f269c879
commit 8b9c4d41cd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=242453
2 changed files with 25 additions and 0 deletions

View file

@ -7,6 +7,7 @@
PORTNAME= IO-KQueue
PORTVERSION= 0.32
PORTREVISION= 1
CATEGORIES= devel perl5
MASTER_SITES= CPAN
PKGNAMEPREFIX= p5-

View file

@ -0,0 +1,24 @@
--- KQueue.xs.orig 2009-09-29 10:42:31.000000000 +0200
+++ KQueue.xs 2009-09-29 10:44:43.000000000 +0200
@@ -107,7 +107,8 @@ kevent(kq, timeout=&PL_sv_undef)
av_push(array, newSViv(ke[i].flags));
av_push(array, newSViv(ke[i].fflags));
av_push(array, newSViv(ke[i].data));
- av_push(array, SvREFCNT_inc(ke[i].udata));
+ if (ke[i].udata)
+ av_push(array, SvREFCNT_inc(ke[i].udata));
PUSHs(sv_2mortal(newRV_noinc((SV*)array)));
}
@@ -152,7 +153,10 @@ get_kev(kq, i)
sv_setiv(AvARRAY(ke2av)[2], ke2[i-1].flags);
sv_setiv(AvARRAY(ke2av)[3], ke2[i-1].fflags);
sv_setiv(AvARRAY(ke2av)[4], ke2[i-1].data);
- av_store(ke2av, 5, SvREFCNT_inc(ke2[i-1].udata));
+ if (ke2[i-1].udata)
+ av_store(ke2av, 5, SvREFCNT_inc(ke2[i-1].udata));
+ else
+ av_store(ke2av, 5, &PL_sv_undef);
RETVAL = newRV_inc((SV*) ke2av);