some nextstep support
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3378 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -57,6 +57,10 @@ RCSID("$Id$");
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -226,7 +230,11 @@ void
|
|||||||
des_rand_data(unsigned char *data, int size)
|
des_rand_data(unsigned char *data, int size)
|
||||||
{
|
{
|
||||||
struct itimerval tv, otv;
|
struct itimerval tv, otv;
|
||||||
|
#ifdef HAVE_SIGACTION
|
||||||
struct sigaction sa, osa;
|
struct sigaction sa, osa;
|
||||||
|
#else
|
||||||
|
RETSIGTYPE (*osa)(int);
|
||||||
|
#endif
|
||||||
int i, j;
|
int i, j;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char *rnd_devices[] = {"/dev/random",
|
char *rnd_devices[] = {"/dev/random",
|
||||||
@@ -253,11 +261,15 @@ des_rand_data(unsigned char *data, int size)
|
|||||||
gsize = size;
|
gsize = size;
|
||||||
igdata = 0;
|
igdata = 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_SIGACTION
|
||||||
/* Setup signal handler */
|
/* Setup signal handler */
|
||||||
sa.sa_handler = sigALRM;
|
sa.sa_handler = sigALRM;
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sigaction(SIGALRM, &sa, &osa);
|
sigaction(SIGALRM, &sa, &osa);
|
||||||
|
#else
|
||||||
|
osa = signal(SIGALRM, sigALRM);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Start timer */
|
/* Start timer */
|
||||||
tv.it_value.tv_sec = 0;
|
tv.it_value.tv_sec = 0;
|
||||||
@@ -287,7 +299,11 @@ des_rand_data(unsigned char *data, int size)
|
|||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
waitpid(pid, NULL, 0);
|
waitpid(pid, NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SIGACTION
|
||||||
sigaction(SIGALRM, &osa, 0);
|
sigaction(SIGALRM, &osa, 0);
|
||||||
|
#else
|
||||||
|
signal(SIGALRM, osa < 0 ? SIG_DFL : osa);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user