From: Lennart Poettering Date: Wed, 17 Jul 2024 15:56:01 +0000 (+0200) Subject: pid1: use $COLUMNS info in status_vprintf() X-Git-Tag: v257-rc1~873^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16044277e9b2810c04970276fda3fb052b742727;p=thirdparty%2Fsystemd.git pid1: use $COLUMNS info in status_vprintf() This way, we can work around the fact that "struct winsize" for /dev/console might not be initialized the moment we open the device. --- diff --git a/src/core/show-status.c b/src/core/show-status.c index 57ad4db30b5..7c7c10f9636 100644 --- a/src/core/show-status.c +++ b/src/core/show-status.c @@ -72,8 +72,14 @@ int status_vprintf(const char *status, ShowStatusFlags flags, const char *format int c; c = fd_columns(fd); - if (c <= 0) - c = 80; + if (c <= 0) { + const char *env = getenv("COLUMNS"); + if (env) + (void) safe_atoi(env, &c); + + if (c <= 0) + c = 80; + } sl = status ? strlen(status_indent) : 0;