summaryrefslogtreecommitdiff
path: root/libavutil/random_seed.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-06-24 21:26:31 +0300
committerMichael Niedermayer <michaelni@gmx.at>2012-09-07 18:41:20 +0200
commita4d71eb5c3a6265afee1c25fea549dd071c1f4a6 (patch)
tree2021abb54c11fe499a79fdf588f035b7dfbfd70a /libavutil/random_seed.c
parent9d0bc5c0bda05ac4441691423501bb3ee280e6e6 (diff)
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> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/random_seed.c')
-rw-r--r--libavutil/random_seed.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index d56280d838..e60ace0090 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -18,7 +18,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <fcntl.h>
#include <math.h>
#include <time.h>
@@ -34,6 +38,7 @@
static int read_random(uint32_t *dst, const char *file)
{
+#if HAVE_UNISTD_H
int fd = open(file, O_RDONLY);
int err = -1;
@@ -43,6 +48,9 @@ static int read_random(uint32_t *dst, const char *file)
close(fd);
return err;
+#else
+ return -1;
+#endif
}
static uint32_t get_generic_seed(void)