if (n == 0 || c == '\n' || c == 0)
break;
+ if (c == 4) { /* C-d also known as EOT */
+ if (ttyfd >= 0)
+ (void) loop_write(ttyfd, "(skipped)", 9, false);
+
+ goto skipped;
+ }
+
if (c == 21) { /* C-u */
if (!(flags & ASK_PASSWORD_SILENT))
if (r < 0)
goto finish;
+skipped:
if (keyname)
(void) add_to_keyring_and_log(keyname, flags, l);
if (r < 0)
return log_error_errno(r, "Failed to query password: %m");
+ if (strv_isempty(passwords))
+ return -ECANCELED;
+
r = send_passwords(socket_name, passwords);
if (r < 0)
return log_error_errno(r, "Failed to send: %m");
pollfd[FD_SIGNAL].events = POLLIN;
for (;;) {
+ int timeout = -1;
+
r = process_password_files();
- if (r < 0)
- log_error_errno(r, "Failed to process password: %m");
+ if (r < 0) {
+ if (r == -ECANCELED)
+ /* Disable poll() timeout since at least one password has
+ * been skipped and therefore one file remains and is
+ * unlikely to trigger any events. */
+ timeout = 0;
+ else
+ log_error_errno(r, "Failed to process password: %m");
+ }
- if (poll(pollfd, _FD_MAX, -1) < 0) {
+ if (poll(pollfd, _FD_MAX, timeout) < 0) {
if (errno == EINTR)
continue;