diff --git a/src/basic/sigbus.c b/src/basic/sigbus.c index 47ab0b81d88..e8d2fdb79a0 100644 --- a/src/basic/sigbus.c +++ b/src/basic/sigbus.c @@ -29,10 +29,10 @@ static void sigbus_push(void *addr) { assert(addr); /* Find a free place, increase the number of entries and leave, if we can */ - for (size_t u = 0; u < SIGBUS_QUEUE_MAX; u++) { + FOREACH_ELEMENT(u, sigbus_queue) { /* OK to initialize this here since we haven't started the atomic ops yet */ void *tmp = NULL; - if (__atomic_compare_exchange_n(&sigbus_queue[u], &tmp, addr, false, + if (__atomic_compare_exchange_n(u, &tmp, addr, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) { __atomic_fetch_add(&n_sigbus_queue, 1, __ATOMIC_SEQ_CST); return; @@ -102,7 +102,7 @@ static void sigbus_handler(int sn, siginfo_t *si, void *data) { assert(si); if (si->si_code != BUS_ADRERR || !si->si_addr) { - assert_se(sigaction(SIGBUS, &old_sigaction, NULL) == 0); + assert_se(sigaction(SIGBUS, &old_sigaction, NULL) >= 0); propagate_signal(sn, si); return; } @@ -133,7 +133,7 @@ void sigbus_install(void) { n_installed++; if (n_installed == 1) - assert_se(sigaction(SIGBUS, &sa, &old_sigaction) == 0); + assert_se(sigaction(SIGBUS, &sa, &old_sigaction) >= 0); return; } @@ -146,7 +146,7 @@ void sigbus_reset(void) { n_installed--; if (n_installed == 0) - assert_se(sigaction(SIGBUS, &old_sigaction, NULL) == 0); + assert_se(sigaction(SIGBUS, &old_sigaction, NULL) >= 0); return; }