mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 02:23:37 +00:00
cmd: Handle truncation for console reads.
This commit is contained in:
parent
e3a72698c1
commit
5e8893f2f6
|
@ -199,7 +199,12 @@ WCHAR *WCMD_fgets(WCHAR *s, int noChars, HANDLE h, BOOL is_console_handle)
|
|||
if (is_console_handle) {
|
||||
status = ReadConsoleW(h, s, noChars, &charsRead, NULL);
|
||||
if (!status) return NULL;
|
||||
s[charsRead-2] = '\0'; /* Strip \r\n */
|
||||
if (s[charsRead-2] == '\r')
|
||||
s[charsRead-2] = '\0'; /* Strip \r\n */
|
||||
else {
|
||||
/* Truncate */
|
||||
s[noChars-1] = '\0';
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue