summaryrefslogtreecommitdiff
path: root/src/tty-ask-password-agent
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-14 00:10:00 +0100
committerLennart Poettering <lennart@poettering.net>2018-02-14 00:11:16 +0100
commitdaa557208de1d77d4aa4f8f8fb162b10d796678f (patch)
tree96fca15e972d589bcb5f66dc709509bd71294ed4 /src/tty-ask-password-agent
parent088dcd8e41c589f1a180124370a90768a8bd521d (diff)
downloadsystemd-daa557208de1d77d4aa4f8f8fb162b10d796678f.tar.gz
tty-ask-password-agent: don't open terminal multiple times
We already have the terminal open, hence pass the fd we got to ask_password_tty(), so that it doesn't have to reopen it a second time. This is mostly an optimization, but it has the nice benefit of making us independent from RLIMIT_NOFILE issues and so on, as we don't need to allocate another fd needlessly.
Diffstat (limited to 'src/tty-ask-password-agent')
-rw-r--r--src/tty-ask-password-agent/tty-ask-password-agent.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index ed9adab067..be7889202c 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -380,7 +380,7 @@ static int parse_password(const char *filename, char **wall) {
}
- r = ask_password_tty(message, NULL, not_after, echo ? ASK_PASSWORD_ECHO : 0, filename, &password);
+ r = ask_password_tty(tty_fd, message, NULL, not_after, echo ? ASK_PASSWORD_ECHO : 0, filename, &password);
if (arg_console) {
tty_fd = safe_close(tty_fd);