X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2Fsignal%2Fsignal.c;h=e6775e7cf5fb05ccf7570fc3c7dad4cfab74e692;hb=da0d02da53b8a309d85ae19e6b9e5ff1cde9c4a5;hp=33722aceb65e5d14d38fd411af9f2b5c80a01d7f;hpb=702bdf4497a72b422c591f69c45aa0be0ee23731;p=pdclib diff --git a/platform/example/functions/signal/signal.c b/platform/example/functions/signal/signal.c index 33722ac..e6775e7 100644 --- a/platform/example/functions/signal/signal.c +++ b/platform/example/functions/signal/signal.c @@ -1,6 +1,4 @@ -/* $Id$ */ - -/* signal( int sig, void (*func)( int ) ) +/* signal( int, void (*)( int ) ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. @@ -22,6 +20,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: @@ -61,11 +63,13 @@ void (*signal( int sig, void (*func)( int ) ) )( int ) #endif #ifdef TEST -#include <_PDCLIB_test.h> + +#include "_PDCLIB_test.h" int main( void ) { - TESTCASE( NO_TESTDRIVER ); + /* Testing covered by raise.c */ return TEST_RESULTS; } + #endif