From: Chen Gang Date: Thu, 22 Jan 2015 16:40:51 +0000 (+0000) Subject: toplev.c (init_local_tick): Process the failure when read fails for random_seed. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0c7990560b5c901884b0c2f5464c3240c0ee02cb;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b636b51d022..aeddcb8e66e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2015-01-23 Chen Gang + * toplev.c (init_local_tick): Process the failure when read + fails for random_seed. + * ubsan.c (ubsan_type_descriptor): Use 'pretty_print' for 'pretty_name' to avoid memory overflow. diff --git a/gcc/toplev.c b/gcc/toplev.c index 7bf177fa970..15b85e1d2e9 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -295,7 +295,9 @@ init_local_tick (void) int fd = open ("/dev/urandom", O_RDONLY); 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); }