]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
butc: clean xbsa shutdown on control C
authorRainer Toebbicke <rtb@pclella.cern.ch>
Wed, 19 Sep 2012 16:13:15 +0000 (12:13 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 3 Apr 2013 17:36:58 +0000 (10:36 -0700)
when we catch a control-c, do a clean shutdown

Reviewed-on: http://gerrit.openafs.org/8141
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit aea3c71e59ec30e84ca4e7383fd3b566ce94bbb6)

Change-Id: I89665c29a522909e126214abaec008a18acb59d7
Reviewed-on: http://gerrit.openafs.org/9495
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/butc/tcmain.c

index 35b2bc49a281ec8d5f64c2a631acbab863ee108a..2c4154db1b4fdd97be04555c9c37923c227524a6 100644 (file)
@@ -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 */