From: afg Date: Tue, 1 Sep 2020 21:20:25 +0000 (+0800) Subject: firstboot: fill empty color if ansi_color unavailable from os-release X-Git-Tag: v247-rc1~316 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ae0d36c161ef0b8bde08d37674eb500061245728;p=thirdparty%2Fsystemd.git firstboot: fill empty color if ansi_color unavailable from os-release --- diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index cf1ec28dd54..e3e1f9e2c8c 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -93,7 +93,7 @@ static bool press_any_key(void) { static void print_welcome(void) { _cleanup_free_ char *pretty_name = NULL, *ansi_color = NULL; static bool done = false; - const char *pn; + const char *pn, *ac; int r; if (!arg_welcome) @@ -112,9 +112,10 @@ static void print_welcome(void) { "Failed to read os-release file, ignoring: %m"); pn = isempty(pretty_name) ? "Linux" : pretty_name; + ac = isempty(ansi_color) ? "0" : ansi_color; if (colors_enabled()) - printf("\nWelcome to your new installation of \x1B[%sm%s\x1B[0m!\n", ansi_color, pn); + printf("\nWelcome to your new installation of \x1B[%sm%s\x1B[0m!\n", ac, pn); else printf("\nWelcome to your new installation of %s!\n", pn);