OpenSSH 2.4.0 patch call..

Chiaki Ishikawa Chiaki.Ishikawa at personal-media.co.jp
Sat Dec 30 14:13:24 EST 2000


X-PMC-CI-e-mail-id: 14371 
>>>>> "|" == Markus Friedl <markus.friedl at informatik.uni-erlangen.de> writes:

    |> On Thu, Dec 28, 2000 at 04:09:07AM +0100, Kevin Steves wrote:
    >> On Wed, 27 Dec 2000 mouring at etoh.eviladmin.org wrote:
    >> : Is there any undisputed patches still out not applied to the current
    >> : portable CVS tree?
    >> 
    >> not a patch per se but proto 2 is broken on hp-ux due to the issue with
    >> the SIGCHLD handler being reinstalled before a wait().

    |> i think we should switch to sigaction since the sematics for
    |> signal() are different on every system.

    |> e.g. replace signal() with mysignal():

Please add handling for
SA_INTERRUPT and SA_RESTART and many will be greatful
for that.
The mods suggested below are taken from 
Stevens Unix Network Programming (but can be found
Advanced Unix Programming by the same author.)
By the way, some people find the one-letter argument names
are difficult to follow.

/* include suitable headers here, ... */
/* for example, sys/signalh on sunos4 */
#include ...

typedef       void (*mysig_t)(int);   

mysig_t
mysignal(int s, mysig_t a)
{
	struct sigaction sa, osa;

	memset(&sa, 0, sizeof sa);
	sigemptyset(&sa.sa_mask);
	sa.sa_flags = 0;
	sa.sa_handler = a;

/* change begins */
	if(s == SIGALRM) {
#ifdef SA_INTERRUPT
	sa.sa_flags |= SA_INTERRUPT; /* sunos 4.x */
#endif
        } else {
#ifdef SA_RESTART
	sa.sa_flags |= SA_RESTART;   /* svr4, 4.4bsd */
#endif
	}
/* change ends */
/* also note the return value is SIG_ERR
   in Steven's book */

	if (sigaction(s, &sa, &osa) < 0)
		return (mysig_t)SIG_ERR;
	return (osa.sa_handler);
}

|>mysignal can fallback to signal if sigaction is not available.
|>with mysignal() we don't need to reinstall signalhandlers.
|>
|>comments?

-markus



-- 
     Ishikawa, Chiaki        ishikawa at personal-media.co.jp.NoSpam  or         
 (family name, given name) Chiaki.Ishikawa at personal-media.co.jp.NoSpam
    Personal Media Corp.      ** Remove .NoSpam at the end before use **     
  Shinagawa, Tokyo, Japan 142-0051







More information about the openssh-unix-dev mailing list