mirror of https://git.ffmpeg.org/ffmpeg.git
random_seed: Only read /dev/*random if we have unistd.h
unistd.h is used for open/read/close, but if this header does not exist, there's probably no use in trying to open /dev/*random at all. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
e312fcde6a
commit
f985113075
|
@ -18,7 +18,11 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -27,6 +31,7 @@
|
||||||
|
|
||||||
static int read_random(uint32_t *dst, const char *file)
|
static int read_random(uint32_t *dst, const char *file)
|
||||||
{
|
{
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
int fd = open(file, O_RDONLY);
|
int fd = open(file, O_RDONLY);
|
||||||
int err = -1;
|
int err = -1;
|
||||||
|
|
||||||
|
@ -36,6 +41,9 @@ static int read_random(uint32_t *dst, const char *file)
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t get_generic_seed(void)
|
static uint32_t get_generic_seed(void)
|
||||||
|
|
Loading…
Reference in New Issue