Commit 0c799056 by Chen Gang Committed by Jeff Law

toplev.c (init_local_tick): Process the failure when read fails for random_seed.

	* toplev.c (init_local_tick): Process the failure when read
	fails for random_seed.

From-SVN: r220006
parent e34a176a
2015-01-23 Chen Gang <gang.chen.5i5j@gmail.com> 2015-01-23 Chen Gang <gang.chen.5i5j@gmail.com>
* toplev.c (init_local_tick): Process the failure when read
fails for random_seed.
* ubsan.c (ubsan_type_descriptor): Use 'pretty_print' for * ubsan.c (ubsan_type_descriptor): Use 'pretty_print' for
'pretty_name' to avoid memory overflow. 'pretty_name' to avoid memory overflow.
......
...@@ -295,7 +295,9 @@ init_local_tick (void) ...@@ -295,7 +295,9 @@ init_local_tick (void)
int fd = open ("/dev/urandom", O_RDONLY); int fd = open ("/dev/urandom", O_RDONLY);
if (fd >= 0) if (fd >= 0)
{ {
read (fd, &random_seed, sizeof (random_seed)); if (read (fd, &random_seed, sizeof (random_seed))
!= sizeof (random_seed))
random_seed = 0;
close (fd); close (fd);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment