mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-01-03 00:02:05 +00:00
- (djm) [openbsd-compat/sigact.c] Avoid NULL derefs in ancient sigaction
replacement code; patch from ighighi AT gmail.com in bz#1240; ok dtucker
This commit is contained in:
parent
30fd49e606
commit
8b7ab960df
@ -1,3 +1,8 @@
|
||||
20080614
|
||||
- (djm) [openbsd-compat/sigact.c] Avoid NULL derefs in ancient sigaction
|
||||
replacement code; patch from ighighi AT gmail.com in bz#1240;
|
||||
ok dtucker
|
||||
|
||||
20080613
|
||||
- (dtucker) OpenBSD CVS Sync
|
||||
- deraadt@cvs.openbsd.org 2008/06/13 09:44:36
|
||||
@ -4364,4 +4369,4 @@
|
||||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||
|
||||
$Id: ChangeLog,v 1.5010 2008/06/13 23:14:46 dtucker Exp $
|
||||
$Id: ChangeLog,v 1.5011 2008/06/15 00:55:34 djm Exp $
|
||||
|
@ -36,6 +36,7 @@
|
||||
/* OPENBSD ORIGINAL: lib/libcurses/base/sigaction.c */
|
||||
|
||||
#include "includes.h"
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include "sigact.h"
|
||||
|
||||
@ -47,28 +48,39 @@
|
||||
int
|
||||
sigaction(int sig, struct sigaction *sigact, struct sigaction *osigact)
|
||||
{
|
||||
return sigvec(sig, &(sigact->sv), &(osigact->sv));
|
||||
return sigvec(sig, sigact ? &sigact->sv : NULL,
|
||||
osigact ? &osigact->sv : NULL);
|
||||
}
|
||||
|
||||
int
|
||||
sigemptyset (sigset_t * mask)
|
||||
sigemptyset (sigset_t *mask)
|
||||
{
|
||||
if (!mask) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*mask = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sigprocmask (int mode, sigset_t * mask, sigset_t * omask)
|
||||
sigprocmask (int mode, sigset_t *mask, sigset_t *omask)
|
||||
{
|
||||
sigset_t current = sigsetmask(0);
|
||||
|
||||
if (omask) *omask = current;
|
||||
if (!mask) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mode==SIG_BLOCK)
|
||||
if (omask)
|
||||
*omask = current;
|
||||
|
||||
if (mode == SIG_BLOCK)
|
||||
current |= *mask;
|
||||
else if (mode==SIG_UNBLOCK)
|
||||
else if (mode == SIG_UNBLOCK)
|
||||
current &= ~*mask;
|
||||
else if (mode==SIG_SETMASK)
|
||||
else if (mode == SIG_SETMASK)
|
||||
current = *mask;
|
||||
|
||||
sigsetmask(current);
|
||||
@ -76,28 +88,44 @@ sigprocmask (int mode, sigset_t * mask, sigset_t * omask)
|
||||
}
|
||||
|
||||
int
|
||||
sigsuspend (sigset_t * mask)
|
||||
sigsuspend (sigset_t *mask)
|
||||
{
|
||||
if (!mask) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
return sigpause(*mask);
|
||||
}
|
||||
|
||||
int
|
||||
sigdelset (sigset_t * mask, int sig)
|
||||
sigdelset (sigset_t *mask, int sig)
|
||||
{
|
||||
if (!mask) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*mask &= ~sigmask(sig);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sigaddset (sigset_t * mask, int sig)
|
||||
sigaddset (sigset_t *mask, int sig)
|
||||
{
|
||||
if (!mask) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
*mask |= sigmask(sig);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sigismember (sigset_t * mask, int sig)
|
||||
sigismember (sigset_t *mask, int sig)
|
||||
{
|
||||
if (!mask) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
return (*mask & sigmask(sig)) != 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user