-int ask_password_tty(const char *message, usec_t until, const char *flag_file, char **_passphrase) {
- struct termios old_termios, new_termios;
- char passphrase[LINE_MAX];
- size_t p = 0;
- int r, ttyfd = -1, notify = -1;
- struct pollfd pollfd[2];
- bool reset_tty = false;
- enum {
- POLL_TTY,
- POLL_INOTIFY
- };
-
- assert(message);
- assert(_passphrase);
-
- if (flag_file) {
- if ((notify = inotify_init1(IN_CLOEXEC)) < 0) {
- r = -errno;
- goto finish;
- }
-
- if (inotify_add_watch(notify, flag_file, IN_ATTRIB /* for the link count */) < 0) {
- r = -errno;
- goto finish;
- }
- }