bin/multiuser: Fix -Wformat-secrity
Change-Id: Iee07090f57973d8fc687cd7d9974c7ceb4517571 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3368 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
3216a85694
commit
0e1b1021ea
@@ -30,7 +30,8 @@ read_password(const char* prompt, char* password, size_t bufferSize,
|
|||||||
// TODO: Open tty with O_NOCTTY!
|
// TODO: Open tty with O_NOCTTY!
|
||||||
tty = fopen("/dev/tty", "w+");
|
tty = fopen("/dev/tty", "w+");
|
||||||
if (tty == NULL) {
|
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;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,11 +61,12 @@ read_password(const char* prompt, char* password, size_t bufferSize,
|
|||||||
status_t error = B_OK;
|
status_t error = B_OK;
|
||||||
|
|
||||||
// prompt and read pwd
|
// prompt and read pwd
|
||||||
fprintf(out, prompt);
|
fputs(prompt, out);
|
||||||
fflush(out);
|
fflush(out);
|
||||||
|
|
||||||
if (fgets(password, bufferSize, in) == NULL) {
|
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;
|
error = errno != 0 ? errno : B_ERROR;
|
||||||
} else
|
} else
|
||||||
fputc('\n', out);
|
fputc('\n', out);
|
||||||
|
|||||||
Reference in New Issue
Block a user