Author: lupus
Date: 2006-09-25 07:50:33 -0400 (Mon, 25 Sep 2006)
New Revision: 65881

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/rand.c
Log:


Mon Sep 25 13:29:53 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>

        * rand.c: fix read loop to correctly handle EINTR.



Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2006-09-25 11:48:43 UTC (rev 65880)
+++ trunk/mono/mono/metadata/ChangeLog  2006-09-25 11:50:33 UTC (rev 65881)
@@ -1,4 +1,8 @@
 
+Mon Sep 25 13:29:53 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>
+
+       * rand.c: fix read loop to correctly handle EINTR.
+
 Mon Sep 25 11:33:06 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>
 
        * Makefile.am, icall-def.h, icall.c, verify.c: changed the way

Modified: trunk/mono/mono/metadata/rand.c
===================================================================
--- trunk/mono/mono/metadata/rand.c     2006-09-25 11:48:43 UTC (rev 65880)
+++ trunk/mono/mono/metadata/rand.c     2006-09-25 11:50:33 UTC (rev 65881)
@@ -229,16 +229,20 @@
                        return NULL; 
                get_entropy_from_server (socket_path, mono_array_addr (arry, 
guchar, 0), mono_array_length (arry));
                return (gpointer) -1;
-       }
-       else {
+       } else {
                /* Read until the buffer is filled. This may block if using 
NAME_DEV_RANDOM. */
                gint count = 0;
                gint err;
 
                do {
                        err = read (file, buf + count, len - count);
+                       if (err < 0) {
+                               if (errno == EINTR)
+                                       continue;
+                               break;
+                       }
                        count += err;
-               } while (err >= 0 && count < len);
+               } while (count < len);
 
                if (err < 0) {
                        g_warning("Entropy error! Error in read (%s).", 
strerror (errno));

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to