X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2Fsignal%2Fsignal.c;h=aae95a95bc1558f1a923bcc4ae56d3eeecee2136;hb=b1ab820c6ded2bcea7e9fbe71df82f9c05fc4f77;hp=33722aceb65e5d14d38fd411af9f2b5c80a01d7f;hpb=d2c7499692ec324dee9fa2e81942fd6478ee24f5;p=pdclib.old diff --git a/platform/example/functions/signal/signal.c b/platform/example/functions/signal/signal.c index 33722ac..aae95a9 100644 --- a/platform/example/functions/signal/signal.c +++ b/platform/example/functions/signal/signal.c @@ -11,6 +11,7 @@ #ifndef REGTEST #include +#include void (*_PDCLIB_sigabrt)( int ) = SIG_DFL; void (*_PDCLIB_sigfpe)( int ) = SIG_DFL; @@ -22,6 +23,10 @@ void (*_PDCLIB_sigterm)( int ) = SIG_DFL; void (*signal( int sig, void (*func)( int ) ) )( int ) { void (*oldhandler)( int ); + if ( sig <= 0 || func == SIG_ERR ) + { + return SIG_ERR; + } switch ( sig ) { case SIGABRT: @@ -49,10 +54,7 @@ void (*signal( int sig, void (*func)( int ) ) )( int ) _PDCLIB_sigterm = func; break; default: - /* The standard calls for an unspecified "positive value". You - will probably want to define a specific value for this. - */ - _PDCLIB_errno = 1; + errno = EINVAL; return SIG_ERR; } return oldhandler; @@ -65,7 +67,7 @@ void (*signal( int sig, void (*func)( int ) ) )( int ) int main( void ) { - TESTCASE( NO_TESTDRIVER ); + /* Testing covered by raise.c */ return TEST_RESULTS; } #endif