From a677b94ad9eca1bfb71dccf869b43e732a61ee9a Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 23 Feb 2025 04:05:55 +0100 Subject: [PATCH] Minor, coding style fixes Signed-off-by: Joachim Wiberg --- src/exec.c | 6 +++--- src/tty.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/exec.c b/src/exec.c index 21426f39..a57640c3 100644 --- a/src/exec.c +++ b/src/exec.c @@ -199,7 +199,6 @@ int run(char *cmd, char *log) int run_interactive(char *cmd, char *fmt, ...) { int status, oldout = 1, olderr = 2; - char line[LINE_SIZE]; FILE *fp; if (!cmd) { @@ -244,6 +243,7 @@ int run_interactive(char *cmd, char *fmt, ...) /* Dump any results of cmd on stderr after we've printed [ OK ] or [FAIL] */ if (fp && !debug) { + char line[LINE_SIZE]; size_t len, written; rewind(fp); @@ -281,7 +281,7 @@ int exec_runtask(char *cmd, char *args[]) return execvp(_PATH_BSHELL, argv); } -static void prepare_tty(char *tty, speed_t speed, char *procname, struct rlimit rlimit[]) +static void prepare_tty(char *tty, speed_t speed, const char *procname, struct rlimit rlimit[]) { char name[80]; int fd, dummy; @@ -351,7 +351,7 @@ static int activate_console(int noclear, int nowait) dprint(STDERR_FILENO, clr, strlen(clr)); dprint(STDERR_FILENO, msg, strlen(msg)); while ((rc = read(STDIN_FILENO, &ch, 1)) > 0 && ch != '\r' && ch != '\n') - continue; + ; /* On any error (likely EINTR), we avoid starting getty */ if (rc == -1) diff --git a/src/tty.c b/src/tty.c index 600fb4cd..e0500832 100644 --- a/src/tty.c +++ b/src/tty.c @@ -229,8 +229,9 @@ int tty_parse_args(struct tty *tty, char *cmd, char **args) return errno = EINVAL; } - dbg("Registering %s getty on TTY %s at %s baud with term %s", tty->cmd ? "external" : "built-in", - tty->dev, tty->baud ?: "0", tty->term ?: "N/A"); + dbg("Registering %s getty on TTY %s at %s baud with term %s", + tty->cmd ? "external" : "built-in", + tty->dev, tty->baud ?: "0", tty->term ?: "N/A"); /* Built-in getty now comes as standalone program */ if (!tty->cmd) {