From 32289112c40ba3f6d0b3c04263654d6223055e22 Mon Sep 17 00:00:00 2001 From: Sam Tygier Date: Mon, 23 Dec 2019 15:20:20 +0000 Subject: [PATCH] wpa_passphrase: Output errors to stderr The stdout of wpa_passphrase is often piped directly into the wpa_supplicant config file. In case of errors these will be written to the file and possibly not noticed by the user. Use fprintf to print errors to stderr. Signed-off-by: Sam Tygier --- wpa_supplicant/wpa_passphrase.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/wpa_passphrase.c b/wpa_supplicant/wpa_passphrase.c index adca1cce1..538997e62 100644 --- a/wpa_supplicant/wpa_passphrase.c +++ b/wpa_supplicant/wpa_passphrase.c @@ -31,9 +31,9 @@ int main(int argc, char *argv[]) if (argc > 2) { passphrase = argv[2]; } else { - printf("# reading passphrase from stdin\n"); + fprintf(stderr, "# reading passphrase from stdin\n"); if (fgets(buf, sizeof(buf), stdin) == NULL) { - printf("Failed to read passphrase\n"); + fprintf(stderr, "Failed to read passphrase\n"); return 1; } buf[sizeof(buf) - 1] = '\0'; @@ -50,11 +50,11 @@ int main(int argc, char *argv[]) len = os_strlen(passphrase); if (len < 8 || len > 63) { - printf("Passphrase must be 8..63 characters\n"); + fprintf(stderr, "Passphrase must be 8..63 characters\n"); return 1; } if (has_ctrl_char((u8 *) passphrase, len)) { - printf("Invalid passphrase character\n"); + fprintf(stderr, "Invalid passphrase character\n"); return 1; }