summaryrefslogtreecommitdiffstats
path: root/bin/ykfde.c
diff options
context:
space:
mode:
authorGravatar Benjamin Pereto <benjamin@sandchaschte.ch>2017-06-14 09:13:04 +0200
committerGravatar Benjamin Pereto <benjamin@sandchaschte.ch>2017-06-14 09:13:04 +0200
commita0963c8ae93d2c70d61bb4ed34c46f3497b66690 (patch)
treee99057d95bc844bf5aa62bba4db366305fe23699 /bin/ykfde.c
parentb5ad306ac967db3f3dace48952437b7729d31087 (diff)
downloadmkinitcpio-ykfde-a0963c8ae93d2c70d61bb4ed34c46f3497b66690.tar.gz
mkinitcpio-ykfde-a0963c8ae93d2c70d61bb4ed34c46f3497b66690.tar.zst
FIX: save old termio structure properly
Diffstat (limited to 'bin/ykfde.c')
-rw-r--r--bin/ykfde.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ykfde.c b/bin/ykfde.c
index cc69636..56e2e0c 100644
--- a/bin/ykfde.c
+++ b/bin/ykfde.c
@@ -69,10 +69,10 @@ char * ask_secret(const char * text) {
/* get terminal properties */
if (tcgetattr(STDIN_FILENO, &tp) < 0) {
onTerminal = false;
+ } else {
tp_save = tp;
}
-
/* disable echo on terminal */
if (onTerminal) {
tp.c_lflag &= ~ECHO;
@@ -92,7 +92,7 @@ char * ask_secret(const char * text) {
/* restore terminal */
if (tcsetattr(STDIN_FILENO, TCSANOW, &tp_save) < 0) {
- fprintf(stderr, "Failed setting terminal attributes.\n");
+ fprintf(stderr, "Failed to restore terminal attributes.\n");
free(factor);
return NULL;
}