Revert the size_t modifications from HEAD that had led to more
[openssl.git] / crypto / rand / randfile.c
index c345d08..c4e6160 100644 (file)
@@ -105,8 +105,7 @@ int RAND_load_file(const char *file, long bytes)
 #ifndef OPENSSL_NO_POSIX_IO
        struct stat sb;
 #endif
-       int i,ret=0;
-       size_t n;
+       int i,ret=0,n;
        FILE *in;
 
        if (file == NULL) return(0);
@@ -163,8 +162,7 @@ err:
 int RAND_write_file(const char *file)
        {
        unsigned char buf[BUFSIZE];
-       int ret=0,rand_err=0;
-       size_t i;
+       int i,ret=0,rand_err=0;
        FILE *out = NULL;
        int n;
 #ifndef OPENSSL_NO_POSIX_IO
@@ -228,7 +226,7 @@ int RAND_write_file(const char *file)
        if (out == NULL) goto err;
 
 #ifndef NO_CHMOD
-       chmod(file,(mode_t)0600);
+       chmod(file,0600);
 #endif
        n=RAND_DATA;
        for (;;)
@@ -238,7 +236,7 @@ int RAND_write_file(const char *file)
                if (RAND_bytes(buf,i) <= 0)
                        rand_err=1;
                i=fwrite(buf,1,i,out);
-               if (i == 0)
+               if (i <= 0)
                        {
                        ret=0;
                        break;