From: Piotr Caban piotr@codeweavers.com
--- dlls/msvcrt/environ.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/msvcrt/environ.c b/dlls/msvcrt/environ.c index 83a493c1a9a..a35d0877891 100644 --- a/dlls/msvcrt/environ.c +++ b/dlls/msvcrt/environ.c @@ -165,17 +165,22 @@ finish: */ errno_t CDECL _putenv_s(const char *name, const char *value) { - int ret; + errno_t ret = 0;
TRACE("%s %s\n", debugstr_a(name), debugstr_a(value));
- if (!MSVCRT_CHECK_PMT(name != NULL)) return -1; - if (!MSVCRT_CHECK_PMT(value != NULL)) return -1; + if (!MSVCRT_CHECK_PMT(name != NULL)) return EINVAL; + if (!MSVCRT_CHECK_PMT(value != NULL)) return EINVAL;
- ret = SetEnvironmentVariableA(name, value[0] ? value : NULL) ? 0 : -1; - - /* _putenv returns success on deletion of nonexistent variable, unlike [Rtl]SetEnvironmentVariable */ - if ((ret == -1) && (GetLastError() == ERROR_ENVVAR_NOT_FOUND)) ret = 0; + if (!SetEnvironmentVariableA(name, value[0] ? value : NULL)) + { + /* _putenv returns success on deletion of nonexistent variable */ + if (GetLastError() != ERROR_ENVVAR_NOT_FOUND) + { + msvcrt_set_errno(GetLastError()); + ret = *_errno(); + } + }
MSVCRT__environ = msvcrt_SnapshotOfEnvironmentA(MSVCRT__environ); MSVCRT__wenviron = msvcrt_SnapshotOfEnvironmentW(MSVCRT__wenviron);
From: Piotr Caban piotr@codeweavers.com
--- dlls/msvcrt/environ.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcrt/environ.c b/dlls/msvcrt/environ.c index a35d0877891..9800a1b66b1 100644 --- a/dlls/msvcrt/environ.c +++ b/dlls/msvcrt/environ.c @@ -191,19 +191,24 @@ errno_t CDECL _putenv_s(const char *name, const char *value) /********************************************************************* * _wputenv_s (MSVCRT.@) */ -int CDECL _wputenv_s(const wchar_t *name, const wchar_t *value) +errno_t CDECL _wputenv_s(const wchar_t *name, const wchar_t *value) { - int ret; + errno_t ret = 0;
TRACE("%s %s\n", debugstr_w(name), debugstr_w(value));
if (!MSVCRT_CHECK_PMT(name != NULL)) return -1; if (!MSVCRT_CHECK_PMT(value != NULL)) return -1;
- ret = SetEnvironmentVariableW(name, value[0] ? value : NULL) ? 0 : -1; - - /* _putenv returns success on deletion of nonexistent variable, unlike [Rtl]SetEnvironmentVariable */ - if ((ret == -1) && (GetLastError() == ERROR_ENVVAR_NOT_FOUND)) ret = 0; + if (!SetEnvironmentVariableW(name, value[0] ? value : NULL)) + { + /* _putenv returns success on deletion of nonexistent variable */ + if (GetLastError() != ERROR_ENVVAR_NOT_FOUND) + { + msvcrt_set_errno(GetLastError()); + ret = *_errno(); + } + }
MSVCRT__environ = msvcrt_SnapshotOfEnvironmentA(MSVCRT__environ); MSVCRT__wenviron = msvcrt_SnapshotOfEnvironmentW(MSVCRT__wenviron);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125241
Your paranoid android.
=== debian11 (build log) ===
Task: Could not create the win32 wineprefix: Failed to disable the crash dialogs: Task: WineTest did not produce the win32 report