changeset 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 d712a21c7c2a
children fbeedf731a67
files src/fileio.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
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