diff options
| author | Eli Zaretskii | 2006-05-19 19:05:07 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2006-05-19 19:05:07 +0000 |
| commit | e00b99c8180dc354a8f053cefe515214274b676e (patch) | |
| tree | 5e9acd51ddf4aea58692b1672353dac7cbe18233 /src | |
| parent | 689840b9224725a0beae741aaaa325d7edb2244c (diff) | |
| download | emacs-e00b99c8180dc354a8f053cefe515214274b676e.tar.gz emacs-e00b99c8180dc354a8f053cefe515214274b676e.zip | |
(init_environment): Perform the processing of environment variables on a copy
of default variables and their values, not on the original.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/w32.c | 19 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5acc6313bbb..621e2632982 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2006-05-19 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32.c (init_environment): Perform the processing of environment | ||
| 4 | variables on a copy of default variables and their values, not on | ||
| 5 | the original. | ||
| 6 | |||
| 1 | 2006-05-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 7 | 2006-05-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 8 | ||
| 3 | * frame.c (x_set_border_width): Remove #ifndef MAC_OS. | 9 | * frame.c (x_set_border_width): Remove #ifndef MAC_OS. |
| @@ -950,11 +950,11 @@ init_environment (char ** argv) | |||
| 950 | struct stat ignored; | 950 | struct stat ignored; |
| 951 | char default_home[MAX_PATH]; | 951 | char default_home[MAX_PATH]; |
| 952 | 952 | ||
| 953 | static struct env_entry | 953 | static const struct env_entry |
| 954 | { | 954 | { |
| 955 | char * name; | 955 | char * name; |
| 956 | char * def_value; | 956 | char * def_value; |
| 957 | } env_vars[] = | 957 | } dflt_envvars[] = |
| 958 | { | 958 | { |
| 959 | {"HOME", "C:/"}, | 959 | {"HOME", "C:/"}, |
| 960 | {"PRELOAD_WINSOCK", NULL}, | 960 | {"PRELOAD_WINSOCK", NULL}, |
| @@ -971,6 +971,17 @@ init_environment (char ** argv) | |||
| 971 | {"LANG", NULL}, | 971 | {"LANG", NULL}, |
| 972 | }; | 972 | }; |
| 973 | 973 | ||
| 974 | #define N_ENV_VARS sizeof(dflt_envvars)/sizeof(dflt_envvars[0]) | ||
| 975 | |||
| 976 | /* We need to copy dflt_envvars[] and work on the copy because we | ||
| 977 | don't want the dumped Emacs to inherit the values of | ||
| 978 | environment variables we saw during dumping (which could be on | ||
| 979 | a different system). The defaults above must be left intact. */ | ||
| 980 | struct env_entry env_vars[N_ENV_VARS]; | ||
| 981 | |||
| 982 | for (i = 0; i < N_ENV_VARS; i++) | ||
| 983 | env_vars[i] = dflt_envvars[i]; | ||
| 984 | |||
| 974 | /* For backwards compatibility, check if a .emacs file exists in C:/ | 985 | /* For backwards compatibility, check if a .emacs file exists in C:/ |
| 975 | If not, then we can try to default to the appdata directory under the | 986 | If not, then we can try to default to the appdata directory under the |
| 976 | user's profile, which is more likely to be writable. */ | 987 | user's profile, which is more likely to be writable. */ |
| @@ -1005,7 +1016,7 @@ init_environment (char ** argv) | |||
| 1005 | LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP, | 1016 | LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP, |
| 1006 | locale_name, sizeof (locale_name))) | 1017 | locale_name, sizeof (locale_name))) |
| 1007 | { | 1018 | { |
| 1008 | for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++) | 1019 | for (i = 0; i < N_ENV_VARS; i++) |
| 1009 | { | 1020 | { |
| 1010 | if (strcmp (env_vars[i].name, "LANG") == 0) | 1021 | if (strcmp (env_vars[i].name, "LANG") == 0) |
| 1011 | { | 1022 | { |
| @@ -1069,7 +1080,7 @@ init_environment (char ** argv) | |||
| 1069 | } | 1080 | } |
| 1070 | } | 1081 | } |
| 1071 | 1082 | ||
| 1072 | for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++) | 1083 | for (i = 0; i < N_ENV_VARS; i++) |
| 1073 | { | 1084 | { |
| 1074 | if (!getenv (env_vars[i].name)) | 1085 | if (!getenv (env_vars[i].name)) |
| 1075 | { | 1086 | { |