Martin Storsjö <[email protected]> writes:

> From: "Ronald S. Bultje" <[email protected]>
>
> Include io.h (which provides open/read/close) on windows.
> ---
>  libavutil/random_seed.c |    7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
> index 51ca99b..9ef000a 100644
> --- a/libavutil/random_seed.c
> +++ b/libavutil/random_seed.c
> @@ -18,7 +18,14 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>
> +#include "config.h"
> +
> +#if HAVE_UNISTD_H
>  #include <unistd.h>
> +#endif
> +#ifdef _WIN32
> +#include <io.h>
> +#endif
>  #include <fcntl.h>
>  #include <math.h>
>  #include <time.h>
> -- 

I'm sceptical about this.  The unistd.h stuff this file uses is only for
accessing /dev/random, which is unlikely to exist if you don't have
unistd.h.  Although not part of any standard, many Unix systems do have
such a file, so if unistd.h is present, it is fair to assume that
/dev/random, if it exists, behaves as expected.  If such a file does
exist on a non-Unix system, there is no telling what it contains, and
using it as a source for (secure) random numbers might not be the best
idea.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to