257 Segfault in the signal handler
Этот коммит содержится в:
родитель
7645027d0d
Коммит
9293ec2c2b
@ -328,15 +328,6 @@ iperf_client_end(struct iperf_test *test)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static jmp_buf sigend_jmp_buf;
|
|
||||||
|
|
||||||
static void
|
|
||||||
sigend_handler(int sig)
|
|
||||||
{
|
|
||||||
longjmp(sigend_jmp_buf, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
iperf_run_client(struct iperf_test * test)
|
iperf_run_client(struct iperf_test * test)
|
||||||
{
|
{
|
||||||
@ -347,11 +338,6 @@ iperf_run_client(struct iperf_test * test)
|
|||||||
struct timeval* timeout = NULL;
|
struct timeval* timeout = NULL;
|
||||||
struct iperf_stream *sp;
|
struct iperf_stream *sp;
|
||||||
|
|
||||||
/* Termination signals. */
|
|
||||||
iperf_catch_sigend(sigend_handler);
|
|
||||||
if (setjmp(sigend_jmp_buf))
|
|
||||||
iperf_got_sigend(test);
|
|
||||||
|
|
||||||
if (test->affinity != -1)
|
if (test->affinity != -1)
|
||||||
if (iperf_setaffinity(test, test->affinity) != 0)
|
if (iperf_setaffinity(test, test->affinity) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -429,15 +429,6 @@ cleanup_server(struct iperf_test *test)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static jmp_buf sigend_jmp_buf;
|
|
||||||
|
|
||||||
static void
|
|
||||||
sigend_handler(int sig)
|
|
||||||
{
|
|
||||||
longjmp(sigend_jmp_buf, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
iperf_run_server(struct iperf_test *test)
|
iperf_run_server(struct iperf_test *test)
|
||||||
{
|
{
|
||||||
@ -447,11 +438,6 @@ iperf_run_server(struct iperf_test *test)
|
|||||||
struct timeval now;
|
struct timeval now;
|
||||||
struct timeval* timeout;
|
struct timeval* timeout;
|
||||||
|
|
||||||
/* Termination signals. */
|
|
||||||
iperf_catch_sigend(sigend_handler);
|
|
||||||
if (setjmp(sigend_jmp_buf))
|
|
||||||
iperf_got_sigend(test);
|
|
||||||
|
|
||||||
if (test->affinity != -1)
|
if (test->affinity != -1)
|
||||||
if (iperf_setaffinity(test, test->affinity) != 0)
|
if (iperf_setaffinity(test, test->affinity) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
16
src/main.c
16
src/main.c
@ -116,12 +116,26 @@ main(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static jmp_buf sigend_jmp_buf;
|
||||||
|
|
||||||
|
static void
|
||||||
|
sigend_handler(int sig)
|
||||||
|
{
|
||||||
|
longjmp(sigend_jmp_buf, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
static int
|
static int
|
||||||
run(struct iperf_test *test)
|
run(struct iperf_test *test)
|
||||||
{
|
{
|
||||||
int consecutive_errors;
|
int consecutive_errors;
|
||||||
|
|
||||||
|
/* Termination signals. */
|
||||||
|
iperf_catch_sigend(sigend_handler);
|
||||||
|
if (setjmp(sigend_jmp_buf))
|
||||||
|
iperf_got_sigend(test);
|
||||||
|
|
||||||
switch (test->role) {
|
switch (test->role) {
|
||||||
case 's':
|
case 's':
|
||||||
if (test->daemon) {
|
if (test->daemon) {
|
||||||
@ -162,5 +176,7 @@ run(struct iperf_test *test)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iperf_catch_sigend(SIG_DFL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user