diff options
author | Richard Levitte <levitte@openssl.org> | 2001-05-03 07:50:39 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2001-05-03 07:50:39 +0000 |
commit | 3c836ff0f8f108786505e768e8452dab111720c1 (patch) | |
tree | 1687fbddd7eba19bd21e91fe53fba57092d82ffc | |
parent | a95639214538b4239e2a15a2cc8087b87bb1cf93 (diff) |
Some platforms (most notably Windows) do not have a $HOME by default.
For those, unless the environment variables RANDFILE or HOME are
defined (the default case!), RAND_file_name() will return NULL.
This change adds a default HOME for those platforms.
To add a default HOME for any platform, just define DEFAULT_HOME in
the proper place, wrapped in appropriate #ifdef..#endif, in e_os.h.
-rw-r--r-- | crypto/rand/randfile.c | 8 | ||||
-rw-r--r-- | e_os.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index 7548ac324c..c2ae28c3a2 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -211,6 +211,12 @@ const char *RAND_file_name(char *buf, size_t size) { if (OPENSSL_issetugid() == 0) s=getenv("HOME"); +#ifdef DEFAULT_HOME + if (s == NULL) + { + s = DEFAULT_HOME; + } +#endif if (s != NULL && (strlen(s)+strlen(RFILE)+2 < size)) { strcpy(buf,s); @@ -220,7 +226,7 @@ const char *RAND_file_name(char *buf, size_t size) strcat(buf,RFILE); ret=buf; } - else + else buf[0] = '\0'; /* no file name */ } return(ret); @@ -224,6 +224,7 @@ extern "C" { # define SSLEAY_CONF OPENSSL_CONF # define NUL_DEV "nul" # define RFILE ".rnd" +# define DEFAULT_HOME "C:" #else /* The non-microsoft world world */ |