aboutsummaryrefslogtreecommitdiff
path: root/crypto/rand/randfile.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2001-05-03 07:50:11 +0000
committerRichard Levitte <levitte@openssl.org>2001-05-03 07:50:11 +0000
commitf0b54fefe9bf7845ca8d2c137f1f5483ac17320c (patch)
treedb30069e2dfe56fc44ca8e3fb292c91c224c7d83 /crypto/rand/randfile.c
parentcf2d9e09b3b0bd0f156ed3831bf6c47b43d3cfc8 (diff)
downloadopenssl-f0b54fefe9bf7845ca8d2c137f1f5483ac17320c.zip
openssl-f0b54fefe9bf7845ca8d2c137f1f5483ac17320c.tar.gz
openssl-f0b54fefe9bf7845ca8d2c137f1f5483ac17320c.tar.bz2
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.
Diffstat (limited to 'crypto/rand/randfile.c')
-rw-r--r--crypto/rand/randfile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c
index 8623e13..982074c 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);