From d226315ef891bdc9cf158ec4abb36cd6fe9b4f8b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 29 May 2025 16:39:50 +1000 Subject: [PATCH] get_tty_password(Windows) - CreateFile error The Windows error condition for failing to open a file is INVALID_HANDLE_VALUE is returned. --- libmariadb/get_password.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libmariadb/get_password.c b/libmariadb/get_password.c index 4a93a738..2ee29f4e 100644 --- a/libmariadb/get_password.c +++ b/libmariadb/get_password.c @@ -122,11 +122,11 @@ char* get_tty_password(char *prompt, char *buffer, int length) if (prompt) fprintf(stderr, "%s", prompt); - if (!(Hdl= CreateFile("CONIN$", - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, 0, NULL))) + if ((Hdl= CreateFile("CONIN$", + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) { /* todo: provide a graphical dialog */ return buffer;