mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	env: use putenv_s for LC_ALL, LANG, etc. #11050
Problem:  ":lang messages en_US.UTF-8" no longer overrides the language
          detected from the environment (at startup).
Solution: In os_setenv, special-case "LC_ALL", "LANG", et al. to use
          putenv_s instead of uv_os_setenv.
fixes #11045
			
			
This commit is contained in:
		| @@ -135,7 +135,16 @@ int os_setenv(const char *name, const char *value, int overwrite) | ||||
|   } | ||||
| #endif | ||||
|   uv_mutex_lock(&mutex); | ||||
|   int r = uv_os_setenv(name, value); | ||||
|   int r; | ||||
| #ifdef WIN32 | ||||
|   // libintl uses getenv() for LC_ALL/LANG/etc., so we must use _putenv_s(). | ||||
|   if (striequal(name, "LC_ALL") || striequal(name, "LANGUAGE") | ||||
|       || striequal(name, "LANG") || striequal(name, "LC_MESSAGES")) { | ||||
|     r = _putenv_s(name, value);  // NOLINT | ||||
|     assert(r == 0); | ||||
|   } | ||||
| #endif | ||||
|   r = uv_os_setenv(name, value); | ||||
|   assert(r != UV_EINVAL); | ||||
|   // Destroy the old map item. Do this AFTER uv_os_setenv(), because `value` | ||||
|   // could be a previous os_getenv() result. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 erw7
					erw7