From: Karel Zak Date: Thu, 11 Oct 2018 11:29:39 +0000 (+0200) Subject: agetty: make output more robust X-Git-Tag: v2.33-rc2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=056a370efbd4b6540fb287e179fe41029c5808e1;p=thirdparty%2Futil-linux.git agetty: make output more robust Signed-off-by: Karel Zak --- diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 6072694ef4..d6703d4f0c 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -1790,20 +1790,25 @@ static void print_issue_file(struct issue *ie, } } - write_all(STDOUT_FILENO, ie->mem, ie->mem_sz); + if (ie->mem_sz) + write_all(STDOUT_FILENO, ie->mem, ie->mem_sz); + if (ie->do_tcrestore) { /* Restore settings. */ tp->c_oflag = oflag; /* Wait till output is gone. */ tcsetattr(STDIN_FILENO, TCSADRAIN, tp); } + #ifdef AGETTY_RELOAD free(ie->mem_old); ie->mem_old = ie->mem; ie->mem = NULL; + ie->mem_sz = 0; #else free(ie->mem); ie->mem = NULL; + ie->mem_sz = 0; #endif }