tAccomodate OpenBSD with /dev/srandom - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit fea3228fece71cef7e9930065cc6c8490613f935
 (DIR) parent bce0902a077bb927023465a6f0b62d37c43ae9b8
 (HTM) Author: rsc <devnull@localhost>
       Date:   Thu, 11 Aug 2005 03:20:57 +0000
       
       Accomodate OpenBSD with /dev/srandom
       
       Diffstat:
         M src/lib9/truerand.c                 |       6 ++++--
       
       1 file changed, 4 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/lib9/truerand.c b/src/lib9/truerand.c
       t@@ -10,10 +10,12 @@ truerand(void)
        
                if(randfd < 0){
                        randfd = open("/dev/random", OREAD);
       +                if(randfd < 0)
       +                        randfd = open("/dev/srandom", OREAD);        /* OpenBSD */
       +                if(randfd < 0)
       +                        sysfatal("can't open /dev/random: %r");
                        fcntl(randfd, F_SETFD, FD_CLOEXEC);
                }
       -        if(randfd < 0)
       -                sysfatal("can't open /dev/random: %r");
                for(i=0; i<sizeof(buf); i += n)
                        if((n = readn(randfd, buf+i, sizeof(buf)-i)) < 0)
                                sysfatal("can't read /dev/random: %r");