sigaddset() and sigdelset() need to set errno if a bad signal number is received
This commit is contained in:
parent
2c53894065
commit
f6b05529da
@ -38,26 +38,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -83,18 +64,18 @@
|
||||
|
||||
int sigaddset(FAR sigset_t *set, int signo)
|
||||
{
|
||||
int ret = ERROR;
|
||||
|
||||
/* Verify the signal */
|
||||
|
||||
if (GOOD_SIGNO(signo))
|
||||
if (!GOOD_SIGNO(signo))
|
||||
{
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Add the signal to the set */
|
||||
|
||||
*set |= SIGNO2SET(signo);
|
||||
ret = OK;
|
||||
return OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -38,26 +38,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -83,18 +64,19 @@
|
||||
|
||||
int sigdelset(FAR sigset_t *set, int signo)
|
||||
{
|
||||
int ret = ERROR;
|
||||
|
||||
/* Verify the signal */
|
||||
|
||||
if (GOOD_SIGNO(signo))
|
||||
if (!GOOD_SIGNO(signo))
|
||||
{
|
||||
/* Delete the signal to the set */
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove the signal from the set */
|
||||
|
||||
*set &= ~SIGNO2SET(signo);
|
||||
ret = OK;
|
||||
return OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -38,26 +38,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -71,7 +52,7 @@
|
||||
* signals are excluded.
|
||||
*
|
||||
* Parameters:
|
||||
* set - Signal set to initalize
|
||||
* set - Signal set to initialize
|
||||
*
|
||||
* Return Value:
|
||||
* 0 (OK), or -1 (ERROR) if the signal set cannot be initialized.
|
||||
|
Loading…
Reference in New Issue
Block a user