summaryrefslogtreecommitdiffstats
path: root/term-utils
diff options
context:
space:
mode:
authorKarel Zak2018-10-11 13:29:39 +0200
committerKarel Zak2018-10-11 13:29:39 +0200
commit056a370efbd4b6540fb287e179fe41029c5808e1 (patch)
tree228e7fc476d3fc9e40dd4e7e6377cb39fac89db1 /term-utils
parentagetty: cleanup issue output change, remove bool (diff)
downloadkernel-qcow2-util-linux-056a370efbd4b6540fb287e179fe41029c5808e1.tar.gz
kernel-qcow2-util-linux-056a370efbd4b6540fb287e179fe41029c5808e1.tar.xz
kernel-qcow2-util-linux-056a370efbd4b6540fb287e179fe41029c5808e1.zip
agetty: make output more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils')
-rw-r--r--term-utils/agetty.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 6072694ef..d6703d4f0 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
}