FILE *out;
FILE *out = NULL;
int RAND_write_file(const char *file)	{	unsigned char buf[BUFSIZE];	int i,ret=0;	FILE *out;	int n;	/* Under VMS, fopen(file, "wb") will create a new version of the	   same file.  This is not good, so let's try updating an existing	   one, and create file only if it doesn't already exist.  This	   should be completely harmless on system that have no file	   versions.					-- Richard Levitte */	out=fopen(file,"rb+");	if (out == NULL#ifdef ENOENT && errno == ENOENT#endif	   )		{		errno = 0;		out=fopen(file,"wb");		}	if (out == NULL) goto err;#ifndef NO_CHMOD	chmod(file,0600);#endif	n=RAND_DATA;	for (;;)		{		i=(n > BUFSIZE)?BUFSIZE:n;		n-=BUFSIZE;		RAND_bytes(buf,i);		i=fwrite(buf,1,i,out);		if (i <= 0)			{			ret=0;			break;			}		ret+=i;		if (n <= 0) break;		}	fclose(out);	memset(buf,0,BUFSIZE);err:	return(ret);	}