Commit f0b54fef authored by Richard Levitte's avatar Richard Levitte
Browse files

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.
parent cf2d9e09
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -230,6 +230,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 */