From: Rainer Toebbicke Date: Wed, 19 Sep 2012 16:13:15 +0000 (-0400) Subject: butc: clean xbsa shutdown on control C X-Git-Tag: upstream/1.6.3^2~44 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=42233dd65b7bf5c6cc31b10a0de728bc0c3495b0;p=packages%2Fo%2Fopenafs.git butc: clean xbsa shutdown on control C when we catch a control-c, do a clean shutdown Reviewed-on: http://gerrit.openafs.org/8141 Reviewed-by: Chas Williams - CONTRACTOR Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit aea3c71e59ec30e84ca4e7383fd3b566ce94bbb6) Change-Id: I89665c29a522909e126214abaec008a18acb59d7 Reviewed-on: http://gerrit.openafs.org/9495 Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Derrick Brashear Reviewed-by: Stephan Wiesand Tested-by: BuildBot --- diff --git a/src/butc/tcmain.c b/src/butc/tcmain.c index 35b2bc49a..2c4154db1 100644 --- a/src/butc/tcmain.c +++ b/src/butc/tcmain.c @@ -831,6 +831,15 @@ GetConfigParams(char *filename, afs_int32 port) return (code); } +#ifdef xbsa +static void +xbsa_shutdown(int x) +{ + xbsa_Finalize(&butxInfo); + exit(0); +} +#endif + static int WorkerBee(struct cmd_syndesc *as, void *arock) { @@ -1019,6 +1028,8 @@ WorkerBee(struct cmd_syndesc *as, void *arock) rc = InitToServer(0 /*taskid */ , &butxInfo, adsmServerName); if (rc != XBSA_SUCCESS) return (1); + (void)signal(SIGINT, xbsa_shutdown); + (void)signal(SIGHUP, xbsa_shutdown); } #endif /*xbsa */