apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/misc/unix rand.c
Date Fri, 13 Sep 2002 15:43:30 GMT
trawick     2002/09/13 08:43:30

  Modified:    .        CHANGES
               misc/unix rand.c
  Log:
  Fix a broken check for a failure to read from the random device file.
  
  PR:             12615
  Submitted by:	tenthumbs@cybernex.net
  
  Revision  Changes    Path
  1.334     +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.333
  retrieving revision 1.334
  diff -u -r1.333 -r1.334
  --- CHANGES	13 Sep 2002 04:59:52 -0000	1.333
  +++ CHANGES	13 Sep 2002 15:43:30 -0000	1.334
  @@ -1,5 +1,8 @@
   Changes with APR 0.9.2
   
  +  *) Fix a broken check for a failure to read from the random device file.
  +     PR 12615  [tenthumbs@cybernex.net]
  +
     *) Print informative link errors on Darwin.  [Justin Erenkrantz]
   
   Changes with APR 0.9.1
  
  
  
  1.15      +8 -3      apr/misc/unix/rand.c
  
  Index: rand.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/rand.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- rand.c	10 Jul 2002 05:54:12 -0000	1.14
  +++ rand.c	13 Sep 2002 15:43:30 -0000	1.15
  @@ -85,15 +85,20 @@
   {
   #ifdef DEV_RANDOM
   
  -    int rnd;
  +    int rnd, rc;
       apr_size_t got, tot;
   
       if ((rnd = open(STR(DEV_RANDOM), O_RDONLY)) == -1) 
   	return errno;
   
  -    for (tot=0; tot<length; tot += got)
  -	if ((got = read(rnd, buf+tot, length-tot)) < 0) 
  +    for (tot=0; tot<length; tot += got) {
  +        if ((rc = read(rnd, buf+tot, length-tot)) < 0) {
   	    return errno;
  +        }
  +        else {
  +            got = rc;
  +        }
  +    }
   
       close(rnd);
   
  
  
  

Mime
View raw message