diff src/fileio.c @ 80664:4aa666fb6103

(Fexpand_file_name): Convert the value of $HOME to a multibyte string.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 02 Aug 2008 09:29:28 +0000
parents df2738e4f7ad
children 0122e7498e18
line wrap: on
line diff
--- a/src/fileio.c	Fri Aug 01 15:10:50 2008 +0000
+++ b/src/fileio.c	Sat Aug 02 09:29:28 2008 +0000
@@ -1066,6 +1066,7 @@
   int length;
   Lisp_Object handler, result;
   int multibyte;
+  Lisp_Object hdir;
 
   CHECK_STRING (name);
 
@@ -1369,9 +1370,19 @@
 #endif /* VMS */
 	  || nm[1] == 0)	/* ~ by itself */
 	{
+	  Lisp_Object tem;
+
 	  if (!(newdir = (unsigned char *) egetenv ("HOME")))
 	    newdir = (unsigned char *) "";
 	  nm++;
+	  /* egetenv may return a unibyte string, which will bite us since
+	     we expect the directory to be multibyte.  */
+	  tem = build_string (newdir);
+	  if (!STRING_MULTIBYTE (tem))
+	    {
+	      hdir = DECODE_FILE (tem);
+	      newdir = SDATA (hdir);
+	    }
 #ifdef DOS_NT
 	  collapse_newdir = 0;
 #endif