Initial support for MacOS.

This will soon be complemented with MacOS specific source code files and
INSTALL.MacOS.

I (Andy) have decided to get rid of a number of #include <sys/types.h>.
I've verified it's ok (both by examining /usr/include/*.h and compiling)
on a number of Unix platforms. Unfortunately I don't have Windows box
to verify this on. I really appreciate if somebody could try to compile
it and contact me a.s.a.p. in case a problem occurs.

Submitted by: Roy Wood <roy@centricsystems.ca>
Reviewed by: Andy Polyakov <appro@fy.chalmers.se>
This commit is contained in:
Andy Polyakov
1999-09-11 17:54:18 +00:00
parent 5bdae1675c
commit 17f389bbbf
18 changed files with 91 additions and 35 deletions

View File

@@ -60,12 +60,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "openssl/e_os.h"
#ifndef NO_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef MAC_OS_pre_X
# include <stat.h>
#else
# include <sys/stat.h>
#endif
#include <openssl/rand.h>
#undef BUFSIZE
@@ -116,19 +122,25 @@ int RAND_write_file(const char *file)
FILE *out;
int n;
/* Under VMS, fopen(file, "wb") will craete a new version of the
/* 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 && errno == ENOENT)
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 (;;)
{