Skip to content
Snippets Groups Projects
Commit e1e2475b authored by Craig Tiller's avatar Craig Tiller
Browse files

Unify signal handling in C

parent 29512b56
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <signal.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h> #include <unistd.h>
...@@ -491,8 +490,6 @@ static grpc_endpoint_test_config configs[] = { ...@@ -491,8 +490,6 @@ static grpc_endpoint_test_config configs[] = {
int main(int argc, char **argv) { int main(int argc, char **argv) {
grpc_test_init(argc, argv); grpc_test_init(argc, argv);
grpc_iomgr_init(); grpc_iomgr_init();
/* disable SIGPIPE */
signal(SIGPIPE, SIG_IGN);
run_tests(); run_tests();
grpc_endpoint_tests(configs[0]); grpc_endpoint_tests(configs[0]);
grpc_iomgr_shutdown(); grpc_iomgr_shutdown();
......
...@@ -107,9 +107,6 @@ grpc_transport_test_config fixture_configs[] = { ...@@ -107,9 +107,6 @@ grpc_transport_test_config fixture_configs[] = {
int main(int argc, char **argv) { int main(int argc, char **argv) {
size_t i; size_t i;
/* disable SIGPIPE */
signal(SIGPIPE, SIG_IGN);
grpc_test_init(argc, argv); grpc_test_init(argc, argv);
grpc_iomgr_init(); grpc_iomgr_init();
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include <stdlib.h> #include <stdlib.h>
#include <signal.h>
#if GPR_GETPID_IN_UNISTD_H #if GPR_GETPID_IN_UNISTD_H
#include <unistd.h> #include <unistd.h>
...@@ -51,6 +52,8 @@ static int seed(void) { ...@@ -51,6 +52,8 @@ static int seed(void) {
#endif #endif
void grpc_test_init(int argc, char **argv) { void grpc_test_init(int argc, char **argv) {
/* disable SIGPIPE */
signal(SIGPIPE, SIG_IGN);
/* seed rng with pid, so we don't end up with the same random numbers as a /* seed rng with pid, so we don't end up with the same random numbers as a
concurrently running test binary */ concurrently running test binary */
srand(seed()); srand(seed());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment