* server.c: Add code to set a signal handler for SIGHUP and a few
authorTom Yu <tlyu@mit.edu>
Tue, 15 Feb 2000 05:13:30 +0000 (05:13 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 15 Feb 2000 05:13:30 +0000 (05:13 +0000)
others so that purify will actually generate memory leak reports.

* configure.in: Add CHECK_SIGNALS.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12042 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/rpc/unit-test/ChangeLog
src/lib/rpc/unit-test/configure.in
src/lib/rpc/unit-test/server.c

index 344713e432e7f7676b4f4d2dc6eaddd6c3a73b58..1c3d4018669e1b8251233802eb9ce3e156ec54a7 100644 (file)
@@ -1,3 +1,10 @@
+2000-02-15  Tom Yu  <tlyu@mit.edu>
+
+       * server.c: Add code to set a signal handler for SIGHUP and a few
+       others so that purify will actually generate memory leak reports.
+
+       * configure.in: Add CHECK_SIGNALS.
+
 2000-02-07  Tom Yu  <tlyu@mit.edu>
 
        * config/unix.exp: Call send_error instead of fail to prevent
index 95f719fbd0cc501d044fc226646d4846e3ce3024..70dec1213ffcaa7dc4c9bee5139b2d39b4c3f98f 100644 (file)
@@ -22,5 +22,6 @@ esac
 changequote([, ])
 AC_SUBST(UDP_TEST)
 dnl
+CHECK_SIGNALS
 KRB5_BUILD_PROGRAM
 V5_AC_OUTPUT_MAKEFILE
index 02537ff04a52d1b35771dd57435e21f4b6b1ef57..7270ea40d8071fef51128151adc90ce1772f1f38 100644 (file)
@@ -12,6 +12,7 @@ static char *rcsid = "$Header$";
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <signal.h>
 #include <gssrpc/rpc.h>
 #include <arpa/inet.h>  /* inet_ntoa */
 #include <gssapi/gssapi.h>
@@ -44,12 +45,20 @@ void usage()
      exit(1);
 }
 
+void handlesig(void)
+{
+    exit(0);
+}
+
 main(int argc, char **argv)
 {
      int c, prot;
      auth_gssapi_name names[2];
      register SVCXPRT *transp;
      extern int optind;
+#ifdef POSIX_SIGNALS
+     struct sigaction sa;
+#endif     
 
      names[0].name = SERVICE_NAME;
      names[0].type = (gss_OID) gss_nt_service_name;
@@ -115,6 +124,18 @@ main(int argc, char **argv)
      _svcauth_gssapi_set_log_badverf_func(rpc_test_badverf, NULL);
      _svcauth_gssapi_set_log_miscerr_func(log_miscerr, NULL);
 
+#ifdef POSIX_SIGNALS
+     (void) sigemptyset(&sa.sa_mask);
+     sa.sa_flags = 0;
+     sa.sa_handler = handlesig;
+     (void) sigaction(SIGHUP, &sa, NULL);
+     (void) sigaction(SIGINT, &sa, NULL);
+     (void) sigaction(SIGTERM, &sa, NULL);
+#else
+     signal(SIGHUP, handlesig);
+     signal(SIGINT, handlesig);
+     signal(SIGTERM, handlesig);
+#endif
      printf("running\n");
      
      svc_run();