From: Alan Burlison Date: Mon, 19 Jul 2004 12:07:02 +0000 (+0100) Subject: Re: POSIX::sigprocmask implemented incorrectly X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b13bbac74f763cf278bfb06cd617733e42684c46;p=p5sagit%2Fp5-mst-13.2.git Re: POSIX::sigprocmask implemented incorrectly Message-ID: <40FBAB56.1030208@sun.com> (last chunk only) p4raw-id: //depot/perl@23194 --- diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index d56c379..c6a6114 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1390,20 +1390,25 @@ sigpending(sigset) SysRet sigprocmask(how, sigset, oldsigset = 0) int how - POSIX::SigSet sigset + POSIX::SigSet sigset = NO_INIT POSIX::SigSet oldsigset = NO_INIT INIT: - if ( items < 3 ) { - oldsigset = 0; + if (SvTYPE(ST(1)) == SVt_NULL) { + sigset = NULL; + } else if (sv_derived_from(ST(1), "POSIX::SigSet")) { + IV tmp = SvIV((SV*)SvRV(ST(1))); + sigset = INT2PTR(POSIX__SigSet,tmp); + } else { + croak("sigset is not of type POSIX::SigSet"); } - else if (sv_derived_from(ST(2), "POSIX::SigSet")) { + + if ( items < 3 || SvTYPE(ST(2)) == SVt_NULL) { + oldsigset = NULL; + } else if (sv_derived_from(ST(2), "POSIX::SigSet")) { IV tmp = SvIV((SV*)SvRV(ST(2))); oldsigset = INT2PTR(POSIX__SigSet,tmp); - } - else { - New(0, oldsigset, 1, sigset_t); - sigemptyset(oldsigset); - sv_setref_pv(ST(2), "POSIX::SigSet", (void*)oldsigset); + } else { + croak("oldsigset is not of type POSIX::SigSet"); } SysRet