Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: binary MIME-Version: 1.0 X-Mailer: MIME-tools 5.411 (Entity 5.404) X-RT-Original-Encoding: iso-8859-1 Content-Length: 2756 From tlyu@MIT.EDU Thu Oct 10 12:56:39 1996 Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id MAA28989 for ; Thu, 10 Oct 1996 12:56:39 -0400 Received: from TESLA-COIL.MIT.EDU by MIT.EDU with SMTP id AA25079; Thu, 10 Oct 96 12:56:37 EDT Received: by tesla-coil.MIT.EDU (5.x/4.7) id AA12308; Thu, 10 Oct 1996 12:56:34 -0400 Message-Id: <199609172115.RAA25762@jik.tiac.net> Date: Tue, 17 Sep 1996 17:15:57 -0400 From: "Jonathan I. Kamens" To: krb5-bugs@MIT.EDU, kerberos@MIT.EDU Subject: krb5b7: telnet: use POSIX signal semantics when they're available >Number: 99 >Category: telnet >Synopsis: krb5b7: telnet: use POSIX signal semantics when they're available >Confidential: yes >Severity: serious >Priority: high >Responsible: hartmans >State: closed >Class: sw-bug >Submitter-Id: unknown >Arrival-Date: Thu Oct e 12:57:06 EDT 1996 >Last-Modified: Fri Oct e 19:57:01 EDT 1996 >Originator: >Organization: >Release: beta-7 >Environment: >Description: >How-To-Repeat: >Fix: >Audit-Trail: Responsible-Changed-From-To: gnats-admin->hartmans Responsible-Changed-By: tlyu Responsible-Changed-When: Thu Oct 10 13:06:55 1996 Responsible-Changed-Why: refiled State-Changed-From-To: open-closed State-Changed-By: hartmans State-Changed-When: Fri Oct 11 19:56:48 1996 State-Changed-Why: Integrated before Gnats deployment >Unformatted: telnet/sys_bsd.c needs to use sigaction() rather than signal() to set up signal handlers with POSIX_SIGNALS is defined, so that the SA_ONESHOT bit won't be set on the resulting handlers, so that they won't be deinstalled after the first time they're invoked. Patch: --- telnet/sys_bsd.c 1996/09/17 20:03:54 1.1 +++ telnet/sys_bsd.c 1996/09/17 20:04:28 1.2 @@ -47,6 +47,9 @@ #include #endif #include +#ifdef POSIX_SIGNALS +#include +#endif /* POSIX_SIGNALS */ #include #include @@ -67,6 +70,30 @@ #ifdef SIGINFO extern SIG_FUNC_RET ayt_status(); #endif + +#ifdef POSIX_SIGNALS +static struct sigaction new_sa_rec, old_sa_rec; + +#ifdef SA_INTERRUPT +#define SIGACTION_INTERRUPT SA_INTERRUPT +#else +#define SIGACTION_INTERRUPT 0 +#endif + +#ifdef SA_NOMASK +#define SIGACTION_NOMASK SA_NOMASK +#else +#define SIGACTION_NOMASK 0 +#endif + +#define signal(sig, func) ((new_sa_rec.sa_handler = func), \ + sigemptyset(&new_sa_rec.sa_mask), \ + (new_sa_rec.sa_flags = SIGACTION_INTERRUPT | \ + SIGACTION_NOMASK), \ + sigaction(sig, &new_sa_rec, &old_sa_rec), \ + old_sa_rec.sa_handler) + +#endif /* POSIX_SIGNALS */ int tout, /* Output file descriptor */