aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@es.net>2017-04-11 15:06:01 -0700
committerBruce A. Mah <bmah@es.net>2017-04-11 15:06:01 -0700
commit6f414a040842b240db4a40a33059e8dab8e0d175 (patch)
treefdebf42bd95d67dddcfe815d1b8140420ec324a6 /src
parent03224c9f56cd59f7375db10c59cb09233f36f392 (diff)
downloadiperf3-6f414a040842b240db4a40a33059e8dab8e0d175.tar.gz
Ignore SIGPIPE signals to simplify error handling.
This is an attempt to avoid server-side crashes/exits when the client abruptly closes its control connection, as found in some testing for #549. Fixes #550.
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 95d5a90..d5bf6ff 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,5 @@
/*
- * iperf, Copyright (c) 2014, 2015, The Regents of the University of
+ * iperf, Copyright (c) 2014, 2015, 2017, The Regents of the University of
* California, through Lawrence Berkeley National Laboratory (subject
* to receipt of any required approvals from the U.S. Dept. of
* Energy). All rights reserved.
@@ -130,6 +130,9 @@ run(struct iperf_test *test)
if (setjmp(sigend_jmp_buf))
iperf_got_sigend(test);
+ /* Ignore SIGPIPE to simplify error handling */
+ signal(SIGPIPE, SIG_IGN);
+
switch (test->role) {
case 's':
if (test->daemon) {
@@ -169,6 +172,7 @@ run(struct iperf_test *test)
}
iperf_catch_sigend(SIG_DFL);
+ signal(SIGPIPE, SIG_DFL);
return 0;
}