You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2007/10/10 17:47:38 UTC

svn commit: r583519 - in /apr/apr/branches/1.2.x: CHANGES misc/unix/rand.c

Author: jorton
Date: Wed Oct 10 08:47:37 2007
New Revision: 583519

URL: http://svn.apache.org/viewvc?rev=583519&view=rev
Log:
Merge r553146 from trunk:

* misc/unix/rand.c (apr_generate_random_bytes): Handle EINTR from
read().

PR: 39790
Submitted by: jorton

Modified:
    apr/apr/branches/1.2.x/CHANGES
    apr/apr/branches/1.2.x/misc/unix/rand.c

Modified: apr/apr/branches/1.2.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/CHANGES?rev=583519&r1=583518&r2=583519&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.2.x/CHANGES [utf-8] Wed Oct 10 08:47:37 2007
@@ -20,6 +20,9 @@
 
 Changes for APR 1.2.11
 
+  *) Fix handling of EINTR from read() in apr_generate_random_bytes()
+     on platforms with /dev/random.  PR 39790.  [Joe Orton]
+
   *) Win32 apr_file_read: Correctly handle completion-based read-to-EOF.
      [Steven Naim <steven.naim googlemail.com>]
 

Modified: apr/apr/branches/1.2.x/misc/unix/rand.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/misc/unix/rand.c?rev=583519&r1=583518&r2=583519&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/misc/unix/rand.c (original)
+++ apr/apr/branches/1.2.x/misc/unix/rand.c Wed Oct 10 08:47:37 2007
@@ -101,7 +101,10 @@
             if ((fd = open(DEV_RANDOM, O_RDONLY)) == -1)
                 return errno;
         
-        rc = read(fd, buf, length);
+        do {
+            rc = read(fd, buf, length);
+        } while (rc == -1 && errno == EINTR);
+
         if (rc < 0) {
             int errnum = errno;
             close(fd);