]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fork-journal: use char* const* for strv input param
authorMike Yuan <me@yhndnzj.com>
Tue, 13 May 2025 20:58:02 +0000 (22:58 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 13 May 2025 21:01:23 +0000 (23:01 +0200)
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 ;-)

src/run/run.c
src/shared/fork-journal.c
src/shared/fork-journal.h
src/systemctl/systemctl-start-unit.c

index 4005d26d451b3a4bfe234848b0b16e44aaec48cc..876e436a5df3f51545bb418357b613c1bd46cbc6 100644 (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)
index ccefc74df039a0032a73a954b0444ab6764de880..8972476e7c9dc2585651078cdeaf81169fe9d65d 100644 (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;
index c7ff87b8f750d38243d6977a82a168e686c932c4..1825a7f5eb7637a53d8902087efca069abcb8c8f 100644 (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);
index 7e81afae0053c05933caff15d1a5e6f1b2914303..1cb2a6db467990a3f59a6d09f143ba148861128c 100644 (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;