X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fask-password-api.c;h=af1b611f2727e1f57561dd7eb3ba0049e0deacbb;hb=a9bd141b4a144d8da062f9f8fa13869bba0c7bce;hp=cd663ae09ccc5712c7b019d0fafaa7f8676d5cd6;hpb=21bc923aa35d455cdef1607eb7022608c705c9f3;p=elogind.git diff --git a/src/ask-password-api.c b/src/ask-password-api.c index cd663ae09..af1b611f2 100644 --- a/src/ask-password-api.c +++ b/src/ask-password-api.c @@ -111,7 +111,7 @@ int ask_password_tty( y = now(CLOCK_MONOTONIC); if (y > until) { - r = -ETIMEDOUT; + r = -ETIME; goto finish; } @@ -132,7 +132,7 @@ int ask_password_tty( r = -errno; goto finish; } else if (k == 0) { - r = -ETIMEDOUT; + r = -ETIME; goto finish; } @@ -179,9 +179,6 @@ int ask_password_tty( } } - if (ttyfd >= 0) - loop_write(ttyfd, "\n", 1, false); - passphrase[p] = 0; if (!(*_passphrase = strdup(passphrase))) { @@ -196,8 +193,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); } @@ -373,7 +373,7 @@ int ask_password_agent( goto finish; } - if ((k = poll(pollfd, _FD_MAX, until-t/USEC_PER_MSEC)) < 0) { + if ((k = poll(pollfd, _FD_MAX, (until-t)/USEC_PER_MSEC)) < 0) { if (errno == EINTR) continue;