From: Roberto S. <rob...@po...> - 2010-09-07 18:23:36
|
This patch adds a call to the tcsd_shutdown() function after the SIGTERM signal is received. Further, the socket 'sd' is closed after this signal is received, in order to avoid waiting the accept(). Signed-off-by: Roberto Sassu <rob...@po...> --- src/tcsd/svrside.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/tcsd/svrside.c b/src/tcsd/svrside.c index 27c18bf..04cb9e5 100644 --- a/src/tcsd/svrside.c +++ b/src/tcsd/svrside.c @@ -43,6 +43,7 @@ struct tcsd_config tcsd_options; struct tpm_properties tpm_metrics; static volatile int hup = 0, term = 0; extern char *optarg; +int sd; static void tcsd_shutdown(void) @@ -61,6 +62,7 @@ static void tcsd_signal_term(int signal) { term = 1; + close(sd); } void @@ -213,7 +215,7 @@ main(int argc, char **argv) { struct sockaddr_in serv_addr, client_addr; TSS_RESULT result; - int sd, newsd, c, option_index = 0; + int newsd, c, option_index = 0; unsigned client_len; char *hostname = NULL; struct passwd *pwd; @@ -339,5 +341,6 @@ main(int argc, char **argv) } while (term ==0); /* To close correctly, we must receive a SIGTERM */ + tcsd_shutdown(); return 0; } -- 1.7.2.2 |