chiark / gitweb /
systemctl: shutdown agent explicitly so that it can reset the tty properly
[elogind.git] / src / ask-password-api.c
index f43075e60194e5a563d345f217109198479fb97c..dd54fb6abf22a0680f0849b67fd31f138a5a180a 100644 (file)
@@ -180,7 +180,6 @@ int ask_password_tty(
         }
 
         if (ttyfd >= 0)
-                loop_write(ttyfd, "\n", 1, false);
 
         passphrase[p] = 0;
 
@@ -196,8 +195,11 @@ finish:
                 close_nointr_nofail(notify);
 
         if (ttyfd >= 0) {
-                if (reset_tty)
+
+                if (reset_tty) {
+                        loop_write(ttyfd, "\n", 1, false);
                         tcsetattr(ttyfd, TCSADRAIN, &old_termios);
+                }
 
                 close_nointr_nofail(ttyfd);
         }