From 9d303e49229bd9c8782c538f15684fde4dcc3e88 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Tue, 15 Feb 2000 05:13:30 +0000 Subject: [PATCH] * 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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12042 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/rpc/unit-test/ChangeLog | 7 +++++++ src/lib/rpc/unit-test/configure.in | 1 + src/lib/rpc/unit-test/server.c | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/lib/rpc/unit-test/ChangeLog b/src/lib/rpc/unit-test/ChangeLog index 344713e43..1c3d40186 100644 --- a/src/lib/rpc/unit-test/ChangeLog +++ b/src/lib/rpc/unit-test/ChangeLog @@ -1,3 +1,10 @@ +2000-02-15 Tom Yu + + * 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 * config/unix.exp: Call send_error instead of fail to prevent diff --git a/src/lib/rpc/unit-test/configure.in b/src/lib/rpc/unit-test/configure.in index 95f719fbd..70dec1213 100644 --- a/src/lib/rpc/unit-test/configure.in +++ b/src/lib/rpc/unit-test/configure.in @@ -22,5 +22,6 @@ esac changequote([, ]) AC_SUBST(UDP_TEST) dnl +CHECK_SIGNALS KRB5_BUILD_PROGRAM V5_AC_OUTPUT_MAKEFILE diff --git a/src/lib/rpc/unit-test/server.c b/src/lib/rpc/unit-test/server.c index 02537ff04..7270ea40d 100644 --- a/src/lib/rpc/unit-test/server.c +++ b/src/lib/rpc/unit-test/server.c @@ -12,6 +12,7 @@ static char *rcsid = "$Header$"; #include #include #include +#include #include #include /* inet_ntoa */ #include @@ -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(); -- 2.26.2