SHA256
1
0
forked from pool/systemd
systemd/keep-crypt-password-prompt.patch

44 lines
1.2 KiB
Diff

--- systemd-210/src/core/manager.c 2014-05-05 11:46:17.700483956 +0200
+++ systemd-210/src/core/manager.c 2014-05-05 13:29:13.296503646 +0200
@@ -152,6 +152,29 @@
}
}
+static int check_for_password_prompt(void) {
+ DIR *d;
+ struct dirent *de;
+
+ if (!(d = opendir("/run/systemd/ask-password"))) {
+ log_error("opendir(): %m");
+
+ if (errno == ENOENT)
+ return 1;
+
+ return -errno;
+ }
+
+ while ((de = readdir(d))) {
+ if (startswith(de->d_name, "ask.")) {
+ closedir(d);
+ return 0;
+ }
+ }
+ closedir(d);
+ return 1;
+}
+
static void manager_print_jobs_in_progress(Manager *m) {
static int is_ansi_console = -1;
_cleanup_free_ char *job_of_n = NULL;
@@ -195,6 +217,10 @@
m->jobs_in_progress_iteration++;
+ //don't overwrite the crypt password prompt with job status messages
+ if (check_for_password_prompt() == 0);
+ return 0;
+
if (m->n_running_jobs > 1)
if (asprintf(&job_of_n, "(%u of %u) ", counter, m->n_running_jobs) < 0)
job_of_n = NULL;