]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ask-password: don't use ttyfd if it is not set
authorLennart Poettering <lennart@poettering.net>
Tue, 13 Feb 2018 22:55:58 +0000 (23:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 13 Feb 2018 22:55:58 +0000 (23:55 +0100)
src/shared/ask-password-api.c

index 99d6a9b143a2ea7a1d84aa8cca8e7d2bf5dcac5d..25cd9eee7fb985c10aa5ca51a17ab436e1b863c7 100644 (file)
@@ -373,7 +373,8 @@ int ask_password_tty(
                                 loop_write(ttyfd, "(no echo) ", 10, false);
                 } else {
                         if (p >= sizeof(passphrase)-1) {
-                                loop_write(ttyfd, "\a", 1, false);
+                                if (ttyfd >= 0)
+                                        loop_write(ttyfd, "\a", 1, false);
                                 continue;
                         }