From 803b3a091c225d48395508a8f9ffa6e08cbddc5b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 14 May 2024 21:23:00 +0200 Subject: Merging upstream version 2.40.1. Signed-off-by: Daniel Baumann --- term-utils/agetty.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'term-utils/agetty.c') diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 0fc6f15..55d9a61 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -1196,7 +1196,8 @@ static void open_tty(const char *tty, struct termios *tp, struct options *op) #endif } - op->term = get_terminal_default_type(op->tty, !(op->flags & F_VCONSOLE)); + if (!op->term) + op->term = get_terminal_default_type(op->tty, !(op->flags & F_VCONSOLE)); if (!op->term) log_err(_("failed to allocate memory: %m")); @@ -1876,6 +1877,7 @@ static int issue_is_changed(struct issue *ie) free(ie->mem_old); ie->mem_old = ie->mem; ie->mem = NULL; + ie->mem_sz = 0; return 0; } @@ -1902,7 +1904,7 @@ static void print_issue_file(struct issue *ie, } } - if (ie->mem_sz) + if (ie->mem_sz && ie->mem) write_all(STDOUT_FILENO, ie->mem, ie->mem_sz); if (ie->do_tcrestore) { @@ -2463,12 +2465,12 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" -H, --host specify login host\n"), out); fputs(_(" -i, --noissue do not display issue file\n"), out); fputs(_(" -I, --init-string set init string\n"), out); - fputs(_(" -J --noclear do not clear the screen before prompt\n"), out); + fputs(_(" -J, --noclear do not clear the screen before prompt\n"), out); fputs(_(" -l, --login-program specify login program\n"), out); fputs(_(" -L, --local-line[=] control the local line flag\n"), out); fputs(_(" -m, --extract-baud extract baud rate during connect\n"), out); fputs(_(" -n, --skip-login do not prompt for login\n"), out); - fputs(_(" -N --nonewline do not print a newline before issue\n"), out); + fputs(_(" -N, --nonewline do not print a newline before issue\n"), out); fputs(_(" -o, --login-options options that are passed to login\n"), out); fputs(_(" -p, --login-pause wait for any key before the login\n"), out); fputs(_(" -r, --chroot change root to the directory\n"), out); @@ -3026,4 +3028,5 @@ static void load_credentials(struct options *op) { op->autolog = str; } } + closedir(dir); } -- cgit v1.2.3