From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- programs/cmd/builtins.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 85040660c3e..f7ccb492932 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -3015,9 +3015,8 @@ RETURN_CODE WCMD_setshow_env(WCHAR *s) /* See if /P supplied, and if so echo the prompt, and read in a reply */ else if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT, - s, 2, L"/P", -1) == CSTR_EQUAL) { - DWORD count; - + s, 2, L"/P", -1) == CSTR_EQUAL) + { s += 2; while (*s && (*s==' ' || *s=='\t')) s++; /* set /P "var=value"jim ignores anything after the last quote */ @@ -3047,9 +3046,8 @@ RETURN_CODE WCMD_setshow_env(WCHAR *s) }
/* Read the reply */ - if (WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), string, ARRAY_SIZE(string), &count) && count > 1) { - string[count-1] = '\0'; /* ReadFile output is not null-terminated! */ - if (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */ + if (WCMD_fgets(string, ARRAY_SIZE(string), GetStdHandle(STD_INPUT_HANDLE)) && *string) + { TRACE("set /p: Setting var '%s' to '%s'\n", wine_dbgstr_w(s), wine_dbgstr_w(string)); if (*string) SetEnvironmentVariableW(s, string);