From 047fcb32247645646249c79dfb4a9d6d14953b0f Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 28 Nov 2018 13:02:49 +0100 Subject: [PATCH] proc: Don't hardcode clr_eol Also check if that is actually defined, not the cur_term proxy. In #5371, we figured out that there are terminfo entries without this capability, so this would do a NULL-dereference. --- src/proc.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/proc.cpp b/src/proc.cpp index 7a1bcf6b7..b49644093 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -564,11 +564,7 @@ static void format_job_info(const job_t *j, job_status_t status) { fwprintf(stdout, L"\r"); fwprintf(stdout, _(msg), j->job_id, truncate_command(j->command()).c_str()); fflush(stdout); - if (cur_term) { - tputs(clr_eol, 1, &writeb); - } else { - fwprintf(stdout, L"\x1B[K"); - } + if (clr_eol) tputs(clr_eol, 1, &writeb); fwprintf(stdout, L"\n"); } @@ -673,11 +669,7 @@ static int process_clean_after_marking(bool allow_interactive) { signal_get_desc(WTERMSIG(p->status))); } - if (cur_term != NULL) { - tputs(clr_eol, 1, &writeb); - } else { - fwprintf(stdout, L"\x1B[K"); // no term set up - do clr_eol manually - } + if (clr_eol) tputs(clr_eol, 1, &writeb); fwprintf(stdout, L"\n"); } found = 1;