From 0e1b1021eab11ad58f2b3ff4cba779a4cb4e2b9a Mon Sep 17 00:00:00 2001 From: Murai Takashi Date: Thu, 15 Oct 2020 06:06:35 +0900 Subject: [PATCH] bin/multiuser: Fix -Wformat-secrity Change-Id: Iee07090f57973d8fc687cd7d9974c7ceb4517571 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3368 Reviewed-by: Adrien Destugues --- src/bin/multiuser/multiuser_utils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bin/multiuser/multiuser_utils.cpp b/src/bin/multiuser/multiuser_utils.cpp index d43b82ab0b..7f538edd23 100644 --- a/src/bin/multiuser/multiuser_utils.cpp +++ b/src/bin/multiuser/multiuser_utils.cpp @@ -30,7 +30,8 @@ read_password(const char* prompt, char* password, size_t bufferSize, // TODO: Open tty with O_NOCTTY! tty = fopen("/dev/tty", "w+"); if (tty == NULL) { - fprintf(stderr, "Error: Failed to open tty: %s\n", strerror(errno)); + fprintf(stderr, "Error: Failed to open tty: %s\n", + strerror(errno)); return errno; } @@ -60,11 +61,12 @@ read_password(const char* prompt, char* password, size_t bufferSize, status_t error = B_OK; // prompt and read pwd - fprintf(out, prompt); + fputs(prompt, out); fflush(out); if (fgets(password, bufferSize, in) == NULL) { - fprintf(out, "\nError: Failed to read from tty: %s\n", strerror(errno)); + fprintf(out, "\nError: Failed to read from tty: %s\n", + strerror(errno)); error = errno != 0 ? errno : B_ERROR; } else fputc('\n', out);