[PATCH] wpa_passphrase: Output errors to stderr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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;
     }

--
2.21.0



_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux