const CGroupContext *cgroup_context,
PidRef *ret) {
- _cleanup_free_ char *subcgroup_path = NULL, *max_log_levels = NULL, *executor_path = NULL;
+ _cleanup_free_ char *subcgroup_path = NULL, *max_log_levels = NULL;
_cleanup_fdset_free_ FDSet *fdset = NULL;
_cleanup_fclose_ FILE *f = NULL;
int r;
assert(unit);
assert(unit->manager);
assert(unit->manager->executor_fd >= 0);
+ assert(unit->manager->executor_path);
assert(command);
assert(context);
assert(params);
if (r < 0)
return log_unit_error_errno(unit, r, "Failed to convert max log levels to string: %m");
- r = fd_get_path(unit->manager->executor_fd, &executor_path);
- if (r < 0)
- return log_unit_error_errno(unit, r, "Failed to get executor path from fd: %m");
-
char serialization_fd_number[DECIMAL_STR_MAX(int)];
xsprintf(serialization_fd_number, "%i", fileno(f));
/* The executor binary is pinned, to avoid compatibility problems during upgrades. */
r = posix_spawn_wrapper(
FORMAT_PROC_FD_PATH(unit->manager->executor_fd),
- STRV_MAKE(executor_path,
+ STRV_MAKE(unit->manager->executor_path,
"--deserialize", serialization_fd_number,
"--log-level", max_log_levels,
"--log-target", log_target_to_string(manager_get_executor_log_target(unit->manager))),
}
if (!FLAGS_SET(test_run_flags, MANAGER_TEST_DONT_OPEN_EXECUTOR)) {
- m->executor_fd = pin_callout_binary(SYSTEMD_EXECUTOR_BINARY_PATH, /* ret_path = */ NULL);
+ m->executor_fd = pin_callout_binary(SYSTEMD_EXECUTOR_BINARY_PATH, &m->executor_path);
if (m->executor_fd < 0)
return log_debug_errno(m->executor_fd, "Failed to pin executor binary: %m");
- if (DEBUG_LOGGING) {
- _cleanup_free_ char *executor_path = NULL;
-
- (void) fd_get_path(m->executor_fd, &executor_path);
- log_debug("Using systemd-executor binary from '%s'.", strna(executor_path));
- }
+ log_debug("Using systemd-executor binary from '%s'.", m->executor_path);
}
/* Note that we do not set up the notify fd here. We do that after deserialization,
#endif
safe_close(m->executor_fd);
+ free(m->executor_path);
return mfree(m);
}