* commit 'f822e7f68eec30bb175ccb46cd379f4a060b6c74': Use pthread_kill() in raise()
This commit is contained in:
commit
42d7a26d23
@ -199,7 +199,6 @@ libc_common_src_files := \
|
||||
bionic/ptsname_r.c \
|
||||
bionic/pututline.c \
|
||||
bionic/pwrite.c \
|
||||
bionic/raise.c \
|
||||
bionic/realpath.c \
|
||||
bionic/reboot.c \
|
||||
bionic/recv.c \
|
||||
@ -282,6 +281,7 @@ libc_bionic_src_files := \
|
||||
bionic/__memcpy_chk.cpp \
|
||||
bionic/__memmove_chk.cpp \
|
||||
bionic/__memset_chk.cpp \
|
||||
bionic/raise.cpp \
|
||||
bionic/__set_errno.cpp \
|
||||
bionic/setlocale.cpp \
|
||||
bionic/__strcat_chk.cpp \
|
||||
|
@ -25,10 +25,14 @@
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
int raise(int signum)
|
||||
{
|
||||
return kill(gettid(), signum);
|
||||
#include <pthread.h>
|
||||
|
||||
int raise(int sig) {
|
||||
int rc = pthread_kill(pthread_self(), sig);
|
||||
if (rc != 0) {
|
||||
errno = rc;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -95,3 +95,9 @@ TEST(signal, sigemptyset_invalid) {
|
||||
TEST(signal, sigfillset_invalid) {
|
||||
TestSigSet1(sigfillset);
|
||||
}
|
||||
|
||||
TEST(signal, raise_invalid) {
|
||||
errno = 0;
|
||||
ASSERT_EQ(-1, raise(-1));
|
||||
ASSERT_EQ(EINVAL, errno);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user