minor fixes to nspawn, machined, vmspawn (#38110)
Nothing earth shattering. Just clean-ups.
This commit is contained in:
@@ -484,7 +484,7 @@ static int print_uid_shift(sd_bus *bus, const char *name) {
|
||||
if (shift == 0) /* Don't show trivial mappings */
|
||||
return 0;
|
||||
|
||||
printf(" UID Shift: %" PRIu32 "\n", shift);
|
||||
printf("\tID Shift: %" PRIu32 "\n", shift);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ int allocate_scope(
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
_cleanup_(bus_wait_for_jobs_freep) BusWaitForJobs *w = NULL;
|
||||
_cleanup_free_ char *scope = NULL;
|
||||
const char *description, *object;
|
||||
const char *object;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@@ -292,12 +292,14 @@ int allocate_scope(
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
||||
description = strjoina("Container ", machine_name);
|
||||
|
||||
r = bus_append_scope_pidref(m, pid, FLAGS_SET(flags, ALLOCATE_SCOPE_ALLOW_PIDFD));
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
||||
_cleanup_free_ char *description = strjoin("Container ", machine_name);
|
||||
if (!description)
|
||||
return log_oom();
|
||||
|
||||
r = sd_bus_message_append(m, "(sv)(sv)(sv)(sv)(sv)",
|
||||
"Description", "s", description,
|
||||
"Delegate", "b", 1,
|
||||
@@ -387,11 +389,11 @@ int terminate_scope(
|
||||
_cleanup_free_ char *scope = NULL;
|
||||
int r;
|
||||
|
||||
r = unit_name_mangle_with_suffix(machine_name, "to terminate", 0, ".scope", &scope);
|
||||
r = unit_name_mangle_with_suffix(machine_name, "to terminate", /* flags= */ 0, ".scope", &scope);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to mangle scope name: %m");
|
||||
|
||||
r = bus_call_method(bus, bus_systemd_mgr, "AbandonScope", &error, NULL, "s", scope);
|
||||
r = bus_call_method(bus, bus_systemd_mgr, "AbandonScope", &error, /* ret_reply= */ NULL, "s", scope);
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to abandon scope '%s', ignoring: %s", scope, bus_error_message(&error, r));
|
||||
sd_bus_error_free(&error);
|
||||
@@ -412,7 +414,7 @@ int terminate_scope(
|
||||
sd_bus_error_free(&error);
|
||||
}
|
||||
|
||||
r = bus_call_method(bus, bus_systemd_mgr, "UnrefUnit", &error, NULL, "s", scope);
|
||||
r = bus_call_method(bus, bus_systemd_mgr, "UnrefUnit", &error, /* ret_reply= */ NULL, "s", scope);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to drop reference to scope '%s', ignoring: %s", scope, bus_error_message(&error, r));
|
||||
|
||||
|
||||
+6
-7
@@ -1332,11 +1332,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NOTIFY_READY:
|
||||
r = parse_boolean(optarg);
|
||||
r = parse_boolean_argument("--notify-ready=", optarg, &arg_notify_ready);
|
||||
if (r < 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"%s is not a valid notify mode. Valid modes are: yes, no, and ready.", optarg);
|
||||
arg_notify_ready = r;
|
||||
return r;
|
||||
|
||||
arg_settings_mask |= SETTING_NOTIFY_READY;
|
||||
break;
|
||||
|
||||
@@ -5483,13 +5482,13 @@ static int run_container(
|
||||
|
||||
r = sd_bus_match_signal_async(
|
||||
bus,
|
||||
NULL,
|
||||
/* ret= */ NULL,
|
||||
"org.freedesktop.systemd1",
|
||||
NULL,
|
||||
/* path= */ NULL,
|
||||
"org.freedesktop.systemd1.Scope",
|
||||
"RequestStop",
|
||||
on_request_stop,
|
||||
NULL,
|
||||
/* install_callback= */ NULL,
|
||||
pid);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to request RequestStop match: %m");
|
||||
|
||||
@@ -727,9 +727,12 @@ static int read_vsock_notify(NotifyConnectionData *d, int fd) {
|
||||
|
||||
p = strv_find_startswith(tags, "EXIT_STATUS=");
|
||||
if (p) {
|
||||
r = safe_atoi(p, d->exit_status);
|
||||
uint8_t k = 0;
|
||||
r = safe_atou8(p, &k);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse exit status from %s, ignoring: %m", p);
|
||||
else
|
||||
*d->exit_status = k;
|
||||
}
|
||||
|
||||
return 1; /* done */
|
||||
|
||||
Reference in New Issue
Block a user