From: Lennart Poettering Date: Fri, 24 Sep 2021 09:05:00 +0000 (+0200) Subject: main: use strv_extendf() where appropriate X-Git-Tag: v250-rc1~625 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=074f0f05874698590ee029ddc32f3eea63aab88a;p=thirdparty%2Fsystemd.git main: use strv_extendf() where appropriate --- diff --git a/src/core/main.c b/src/core/main.c index 58c7b96881d..ff7f189370d 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1535,20 +1535,16 @@ static int become_shutdown( watchdog_timer = arg_kexec_watchdog; if (timestamp_is_set(watchdog_timer)) { - char *e; - - /* If we reboot or kexec let's set the shutdown watchdog and - * tell the shutdown binary to repeatedly ping it */ + /* If we reboot or kexec let's set the shutdown watchdog and tell the shutdown binary to + * repeatedly ping it */ r = watchdog_setup(watchdog_timer); watchdog_close(r < 0); /* Tell the binary how often to ping, ignore failure */ - if (asprintf(&e, "WATCHDOG_USEC="USEC_FMT, watchdog_timer) > 0) - (void) strv_consume(&env_block, e); + (void) strv_extendf(&env_block, "WATCHDOG_USEC="USEC_FMT, watchdog_timer); - if (arg_watchdog_device && - asprintf(&e, "WATCHDOG_DEVICE=%s", arg_watchdog_device) > 0) - (void) strv_consume(&env_block, e); + if (arg_watchdog_device) + (void) strv_extendf(&env_block, "WATCHDOG_DEVICE=%s", arg_watchdog_device); } else watchdog_close(true);