diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2012-06-24 21:26:31 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-06-29 15:52:07 +0300 |
commit | f985113075b0c571b1b1b166fe28f87f0f291be5 (patch) | |
tree | bbfae34b3c0990aa1b797b66c3e962ffaa44fd47 | |
parent | e312fcde6a46d7fdfc5f3f880dd97987402d7138 (diff) | |
download | ffmpeg-f985113075b0c571b1b1b166fe28f87f0f291be5.tar.gz |
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>
-rw-r--r-- | libavutil/random_seed.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c index 51ca99b26d..8ee4cb716e 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> @@ -27,6 +31,7 @@ static int read_random(uint32_t *dst, const char *file) { +#if HAVE_UNISTD_H int fd = open(file, O_RDONLY); int err = -1; @@ -36,6 +41,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) |