diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-02-14 00:10:00 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-02-14 00:11:16 +0100 |
commit | daa557208de1d77d4aa4f8f8fb162b10d796678f (patch) | |
tree | 96fca15e972d589bcb5f66dc709509bd71294ed4 /src/firstboot | |
parent | ask-password: derive pollfd array from enum (diff) | |
download | systemd-daa557208de1d77d4aa4f8f8fb162b10d796678f.tar.xz systemd-daa557208de1d77d4aa4f8f8fb162b10d796678f.zip |
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/firstboot')
-rw-r--r-- | src/firstboot/firstboot.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 262e520d56..effa092ec9 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -558,7 +558,7 @@ static int prompt_root_password(void) { for (;;) { _cleanup_string_free_erase_ char *a = NULL, *b = NULL; - r = ask_password_tty(msg1, NULL, 0, 0, NULL, &a); + r = ask_password_tty(-1, msg1, NULL, 0, 0, NULL, &a); if (r < 0) return log_error_errno(r, "Failed to query root password: %m"); @@ -567,7 +567,7 @@ static int prompt_root_password(void) { break; } - r = ask_password_tty(msg2, NULL, 0, 0, NULL, &b); + r = ask_password_tty(-1, msg2, NULL, 0, 0, NULL, &b); if (r < 0) return log_error_errno(r, "Failed to query root password: %m"); |