Skip to content

Commit aca0806

Browse files
committed
test BUGFIX ignore invalid SIGPIPE
1 parent 554476d commit aca0806

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/test_unix_socket.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <pthread.h>
2222
#include <pwd.h>
2323
#include <setjmp.h>
24+
#include <signal.h>
2425
#include <stdarg.h>
2526
#include <stdio.h>
2627
#include <stdlib.h>
@@ -475,6 +476,7 @@ test_cleartext_path(void **state)
475476
int
476477
main(void)
477478
{
479+
struct sigaction action = {0};
478480
const struct CMUnitTest tests[] = {
479481
cmocka_unit_test_setup(test_connect, setup_local_f),
480482
cmocka_unit_test_setup(test_invalid_user, setup_local_f),
@@ -485,5 +487,10 @@ main(void)
485487
};
486488

487489
setenv("CMOCKA_TEST_ABORT", "1", 1);
490+
491+
/* ignore SIGPIPE */
492+
action.sa_handler = SIG_IGN;
493+
sigaction(SIGPIPE, &action, NULL);
494+
488495
return cmocka_run_group_tests(tests, setup_glob_f, ln2_glob_test_teardown);
489496
}

0 commit comments

Comments
 (0)