From 95cb4672b375a53411f23a4e984c8d4d529fe815 Mon Sep 17 00:00:00 2001 From: Alexandru Bagu Date: Mon, 18 Oct 2021 17:36:35 -0400 Subject: [PATCH] fix build issues for VS2010 --- libfreerdp/utils/passphrase.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libfreerdp/utils/passphrase.c b/libfreerdp/utils/passphrase.c index d6c4bbf35..24ef51a51 100644 --- a/libfreerdp/utils/passphrase.c +++ b/libfreerdp/utils/passphrase.c @@ -28,12 +28,13 @@ #include #include +#include char read_chr(int isTty) { + char chr; if (isTty) return _getch(); - char chr; if (scanf_s("%c", &chr, (UINT32)sizeof(char)) && !feof(stdin)) return chr; return 0; @@ -47,12 +48,14 @@ char* freerdp_passphrase_read(const char* prompt, char* buf, size_t bufsiz, int const char CARRIAGERETURN = '\r'; const char SHOW_ASTERISK = TRUE; + size_t read_cnt = 0, chr; + char isTty; + if (from_stdin) { printf("%s ", prompt); fflush(stdout); - size_t read_cnt = 0, chr; - char isTty = _isatty(_fileno(stdin)); + isTty = _isatty(_fileno(stdin)); while (read_cnt < bufsiz - 1 && (chr = read_chr(isTty)) && chr != NEWLINE && chr != CARRIAGERETURN) {