Read /dev/urandom unbuffered
authorMatthias Clasen <mclasen@redhat.com>
Fri, 28 Aug 2009 02:59:05 +0000 (22:59 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 28 Aug 2009 02:59:05 +0000 (22:59 -0400)
To avoid wasting entropy. Bug 593232.

glib/grand.c

index 55f8970..8edcca3 100644 (file)
@@ -181,6 +181,7 @@ g_rand_new (void)
        {
          int r;
 
+         setvbuf (dev_urandom, NULL, _IONBF, 0);
          do
            {
              errno = 0;