Make the probe for RNG sources at runtime since the configure script isn't

compatible with cross-compiling.


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@744 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Pierre Ossman 2006-04-18 15:16:24 +00:00
parent e4b2a47bb1
commit c22a0c12e4
4 changed files with 65 additions and 65 deletions

View file

@ -63,6 +63,7 @@
#include <polypcore/cli-text.h>
#include <polypcore/pid.h>
#include <polypcore/namereg.h>
#include <polypcore/random.h>
#include "cmdline.h"
#include "cpulimit.h"
@ -135,29 +136,6 @@ static void close_pipe(int p[2]) {
p[0] = p[1] = -1;
}
static void set_random_seed(void) {
unsigned int seed = 0;
#ifdef RANDOM_DEVICE
int fd;
if ((fd = open(RANDOM_DEVICE, O_RDONLY)) >= 0) {
ssize_t r;
if ((r = pa_loop_read(fd, &seed, sizeof(seed))) < 0 || (size_t) r != sizeof(seed)) {
pa_log_error(__FILE__": failed to read entropy from '"RANDOM_DEVICE"'");
seed += (unsigned int) time(NULL);
}
close(fd);
}
#else
seed = (unsigned int) time(NULL);
#endif
srand(seed);
}
int main(int argc, char *argv[]) {
pa_core *c;
pa_strbuf *buf = NULL;
@ -203,7 +181,7 @@ int main(int argc, char *argv[]) {
}
#endif
set_random_seed();
pa_random_seed();
pa_log_set_ident("polypaudio");