Merge pull request #20138 from keszybz/coding-style-variable-decls

A coding style tweak and checking of sd_notify() calls and voidification of pager_open()
This commit is contained in:
Luca Boccassi
2021-11-05 13:57:30 +00:00
committed by GitHub
48 changed files with 192 additions and 170 deletions
+12 -5
View File
@@ -304,7 +304,7 @@ static int help(void) {
_cleanup_free_ char *link = NULL;
int r;
(void) pager_open(arg_pager_flags);
pager_open(arg_pager_flags);
r = terminal_urlify_man("systemd-nspawn", "1", &link);
if (r < 0)
@@ -4205,6 +4205,7 @@ static int nspawn_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t r
ssize_t n;
pid_t inner_child_pid;
_cleanup_strv_free_ char **tags = NULL;
int r;
assert(userdata);
@@ -4243,8 +4244,11 @@ static int nspawn_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t r
if (!tags)
return log_oom();
if (strv_find(tags, "READY=1"))
(void) sd_notifyf(false, "READY=1\n");
if (strv_find(tags, "READY=1")) {
r = sd_notify(false, "READY=1\n");
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
}
p = strv_find_startswith(tags, "STATUS=");
if (p)
@@ -5134,8 +5138,11 @@ static int run_container(
(void) sd_notifyf(false,
"STATUS=Container running.\n"
"X_NSPAWN_LEADER_PID=" PID_FMT, *pid);
if (!arg_notify_ready)
(void) sd_notify(false, "READY=1\n");
if (!arg_notify_ready) {
r = sd_notify(false, "READY=1\n");
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
}
if (arg_kill_signal > 0) {
/* Try to kill the init system on SIGINT or SIGTERM */