1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

main: use strv_extendf() where appropriate

This commit is contained in:
Lennart Poettering 2021-09-24 11:05:00 +02:00 committed by Yu Watanabe
parent f71f76bb97
commit 074f0f0587

View File

@ -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);