aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_passphrase.c
diff options
context:
space:
mode:
authorSam Tygier <samtygier@yahoo.co.uk>2019-12-23 15:20:20 (GMT)
committerJouni Malinen <j@w1.fi>2019-12-24 09:14:27 (GMT)
commit32289112c40ba3f6d0b3c04263654d6223055e22 (patch)
tree4edde4b2a1b8faecabee0e12ac6a362505131373 /wpa_supplicant/wpa_passphrase.c
parentce1598d4c2b0f5cd925aab1a199f9da82361c1dd (diff)
downloadhostap-32289112c40ba3f6d0b3c04263654d6223055e22.zip
hostap-32289112c40ba3f6d0b3c04263654d6223055e22.tar.gz
hostap-32289112c40ba3f6d0b3c04263654d6223055e22.tar.bz2
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 <samtygier@yahoo.co.uk>
Diffstat (limited to 'wpa_supplicant/wpa_passphrase.c')
-rw-r--r--wpa_supplicant/wpa_passphrase.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/wpa_supplicant/wpa_passphrase.c b/wpa_supplicant/wpa_passphrase.c
index adca1cc..538997e 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;
}