mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 14:20:07 +00:00
linux/sigsetops: fix type confusion (bug 31468)
Each mask in the sigset array is an unsigned long, so fix __sigisemptyset to use that instead of int. The __sigword function returns a simple array index, so it can return int instead of unsigned long.
This commit is contained in:
parent
aeee41f1cf
commit
2173173d57
@ -89,6 +89,17 @@ do_test (void)
|
||||
TEST_COMPARE (sigisemptyset (&set), 1);
|
||||
}
|
||||
|
||||
{
|
||||
sigset_t set;
|
||||
for (int sig = 1; sig <= NSIG; sig++)
|
||||
{
|
||||
sigemptyset (&set);
|
||||
if (sigaddset (&set, sig) < 0)
|
||||
continue;
|
||||
TEST_COMPARE (sigisemptyset (&set), 0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ static inline int
|
||||
internal_sigisemptyset (const internal_sigset_t *set)
|
||||
{
|
||||
int cnt = __NSIG_WORDS;
|
||||
int ret = set->__val[--cnt];
|
||||
unsigned long int ret = set->__val[--cnt];
|
||||
while (ret == 0 && --cnt >= 0)
|
||||
ret = set->__val[cnt];
|
||||
return ret == 0;
|
||||
@ -82,7 +82,7 @@ static inline int
|
||||
internal_sigismember (const internal_sigset_t *set, int sig)
|
||||
{
|
||||
unsigned long int mask = __sigmask (sig);
|
||||
unsigned long int word = __sigword (sig);
|
||||
int word = __sigword (sig);
|
||||
return set->__val[word] & mask ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ static inline void
|
||||
internal_sigaddset (internal_sigset_t *set, int sig)
|
||||
{
|
||||
unsigned long int mask = __sigmask (sig);
|
||||
unsigned long int word = __sigword (sig);
|
||||
int word = __sigword (sig);
|
||||
set->__val[word] |= mask;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ static inline void
|
||||
internal_sigdelset (internal_sigset_t *set, int sig)
|
||||
{
|
||||
unsigned long int mask = __sigmask (sig);
|
||||
unsigned long int word = __sigword (sig);
|
||||
int word = __sigword (sig);
|
||||
set->__val[word] &= ~mask;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
(1UL << (((sig) - 1) % ULONG_WIDTH))
|
||||
|
||||
/* Return the word index for SIG. */
|
||||
static inline unsigned long int
|
||||
static inline int
|
||||
__sigword (int sig)
|
||||
{
|
||||
return (sig - 1) / ULONG_WIDTH;
|
||||
@ -66,7 +66,7 @@ static inline int
|
||||
__sigisemptyset (const sigset_t *set)
|
||||
{
|
||||
int cnt = __NSIG_WORDS;
|
||||
int ret = set->__val[--cnt];
|
||||
unsigned long int ret = set->__val[--cnt];
|
||||
while (ret == 0 && --cnt >= 0)
|
||||
ret = set->__val[cnt];
|
||||
return ret == 0;
|
||||
@ -92,7 +92,7 @@ static inline int
|
||||
__sigismember (const sigset_t *set, int sig)
|
||||
{
|
||||
unsigned long int mask = __sigmask (sig);
|
||||
unsigned long int word = __sigword (sig);
|
||||
int word = __sigword (sig);
|
||||
return set->__val[word] & mask ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ static inline void
|
||||
__sigaddset (sigset_t *set, int sig)
|
||||
{
|
||||
unsigned long int mask = __sigmask (sig);
|
||||
unsigned long int word = __sigword (sig);
|
||||
int word = __sigword (sig);
|
||||
set->__val[word] |= mask;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ static inline void
|
||||
__sigdelset (sigset_t *set, int sig)
|
||||
{
|
||||
unsigned long int mask = __sigmask (sig);
|
||||
unsigned long int word = __sigword (sig);
|
||||
int word = __sigword (sig);
|
||||
set->__val[word] &= ~mask;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user