Merge from emacs--rel--22
[bpt/emacs.git] / src / fileio.c
index 4430cf4..f478b4a 100644 (file)
@@ -2224,8 +2224,8 @@ duplicates what `expand-file-name' does.  */)
        /* Get variable value */
        o = (unsigned char *) egetenv (target);
        if (o)
-         {
-           total += strlen (o);
+         { /* Eight-bit chars occupy upto 2 bytes in multibyte.  */
+           total += strlen (o) * (STRING_MULTIBYTE (filename) ? 2 : 1);
            substituted = 1;
          }
        else if (*p == '}')