]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getpass: replace `getch()` call with `_getch()` on Windows
authorViktor Szakats <commit@vsz.me>
Tue, 26 Nov 2024 12:03:49 +0000 (13:03 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 27 Nov 2024 10:19:16 +0000 (11:19 +0100)
`getch()` is deprecated according to MSDN:
https://learn.microsoft.com/cpp/c-runtime-library/reference/getch
"The Microsoft-specific function name `getch` is a deprecated alias
for the `_getch` function."

Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/getch-getwch

Follow-up to 72edb22b8a0e1e62216b59a045147d1a863ad59b #15638
Closes #15642

src/tool_getpass.c

index 412c50a114aa7db13d232c3de7aae43eeb7f9872..91dfb4638ab910e77f429eb8daa91e5d2abd036c 100644 (file)
@@ -102,7 +102,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
   fputs(prompt, tool_stderr);
 
   for(i = 0; i < buflen; i++) {
-    buffer[i] = (char)getch();
+    buffer[i] = (char)_getch();
     if(buffer[i] == '\r' || buffer[i] == '\n') {
       buffer[i] = '\0';
       break;