Typo which prevents mult valued RDNs being created.
[openssl.git] / crypto / rand / randfile.c
index f5d0843d139d80b217b051cfceb17a959fee23b8..d69bdf8b8a04031abe2c1d65df5a29347a87f98c 100644 (file)
@@ -57,7 +57,7 @@
  */
 
 /* We need to define this to get macros like S_IFBLK and S_IFCHR */
-#define _XOPEN_SOURCE 1
+#define _XOPEN_SOURCE 500
 
 #include <errno.h>
 #include <stdio.h>
@@ -104,7 +104,7 @@ int RAND_load_file(const char *file, long bytes)
 
        i=stat(file,&sb);
        /* If the state fails, put some crap in anyway */
-       RAND_add(&sb,sizeof(sb),0);
+       RAND_add(&sb,sizeof(sb),0.0);
        if (i < 0) return(0);
        if (bytes == 0) return(ret);
 
@@ -129,7 +129,7 @@ int RAND_load_file(const char *file, long bytes)
                i=fread(buf,1,n,in);
                if (i <= 0) break;
                /* even if n != i, use the full array */
-               RAND_add(buf,n,i);
+               RAND_add(buf,n,(double)i);
                ret+=i;
                if (bytes > 0)
                        {
@@ -166,6 +166,7 @@ int RAND_write_file(const char *file)
        }
 
 #if defined(O_CREAT) && !defined(OPENSSL_SYS_WIN32)
+       {
        /* For some reason Win32 can't write to files created this way */
        
        /* chmod(..., 0600) is too late to protect the file,
@@ -173,6 +174,7 @@ int RAND_write_file(const char *file)
        int fd = open(file, O_CREAT, 0600);
        if (fd != -1)
                out = fdopen(fd, "wb");
+       }
 #endif
        if (out == NULL)
                out = fopen(file,"wb");