fork-journal: use char* const* for strv input param

This is compatible with char** and is what I originally
asked for in
https://github.com/systemd/systemd/pull/36858#discussion_r2086792739
Someone needs to read better ;-)
This commit is contained in:
Mike Yuan
2025-05-13 22:58:02 +02:00
parent c49c2477a4
commit b86b1ca22f
4 changed files with 5 additions and 5 deletions

View File

@@ -2438,7 +2438,7 @@ static int start_transient_service(sd_bus *bus) {
_cleanup_(journal_terminate) PidRef journal_pid = PIDREF_NULL;
if (arg_verbose)
(void) journal_fork(arg_runtime_scope, (const char**) STRV_MAKE(c.unit), &journal_pid);
(void) journal_fork(arg_runtime_scope, STRV_MAKE(c.unit), &journal_pid);
r = bus_call_with_hint(bus, m, "service", &reply);
if (r < 0)

View File

@@ -87,7 +87,7 @@ static int on_child_notify(sd_event_source *s, int fd, uint32_t revents, void *u
return 0;
}
int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidref) {
int journal_fork(RuntimeScope scope, char * const *units, PidRef *ret_pidref) {
int r;
assert(scope >= 0);
@@ -97,7 +97,7 @@ int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidr
if (!is_main_thread())
return -EPERM;
if (strv_isempty((char**) units))
if (strv_isempty(units))
return 0;
_cleanup_(sd_event_unrefp) sd_event *event = NULL;

View File

@@ -6,6 +6,6 @@
#include "runtime-scope.h"
#include "set.h"
int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidref);
int journal_fork(RuntimeScope scope, char * const *units, PidRef *ret_pidref);
void journal_terminate(PidRef *pidref);

View File

@@ -394,7 +394,7 @@ int verb_start(int argc, char *argv[], void *userdata) {
ret = enqueue_marked_jobs(bus, w);
else {
if (arg_verbose)
(void) journal_fork(arg_runtime_scope, (const char**) names, &journal_pid);
(void) journal_fork(arg_runtime_scope, names, &journal_pid);
STRV_FOREACH(name, names) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;