X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Frand.c;h=28e4b8716022d292b3251a7b774e2b5ccbdf43a8;hb=b50dc8d84850e0452a7a4d742ed0a0fa46fe491e;hp=4dfae9a948c1bbda3e8b5bdaa44faca8a1e3fad9;hpb=28fb10e2b8f570f194c65d0ba85d02e6a13d16ee;p=mono.git diff --git a/mono/metadata/rand.c b/mono/metadata/rand.c index 4dfae9a948c..28e4b871602 100644 --- a/mono/metadata/rand.c +++ b/mono/metadata/rand.c @@ -95,7 +95,7 @@ get_entropy_from_server (const char *path, guchar *buf, int len) #if defined (PLATFORM_WIN32) #include -#include +#include #ifndef PROV_INTEL_SEC #define PROV_INTEL_SEC 22 @@ -229,16 +229,20 @@ ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpo 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));