changeset 34104:c9980ec72766

(Fread_file_name) [DOS_NT]: Don't crash if homedir is NULL.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 02 Dec 2000 11:16:13 +0000
parents d23d6a3e8128
children 9f894ba9e808
files src/fileio.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Sat Dec 02 10:23:33 2000 +0000
+++ b/src/fileio.c	Sat Dec 02 11:16:13 2000 +0000
@@ -5627,8 +5627,13 @@
   /* If dir starts with user's homedir, change that to ~. */
   homedir = (char *) egetenv ("HOME");
 #ifdef DOS_NT
-  homedir = strcpy (alloca (strlen (homedir) + 1), homedir);
-  CORRECT_DIR_SEPS (homedir);
+  /* homedir can be NULL in temacs, since Vprocess_environment is not
+     yet set up.  We shouldn't crash in that case.  */
+  if (homedir != 0)
+    {
+      homedir = strcpy (alloca (strlen (homedir) + 1), homedir);
+      CORRECT_DIR_SEPS (homedir);
+    }
 #endif
   if (homedir != 0
       && STRINGP (dir)