]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: Update prototype of notify_message, tags list is read only
authorBenjamin Robin <dev@benjarobin.fr>
Sun, 10 May 2020 16:38:08 +0000 (18:38 +0200)
committerBenjamin Robin <dev@benjarobin.fr>
Sun, 10 May 2020 16:58:03 +0000 (18:58 +0200)
Indicates that the tags list cannot be modified by notify_message function.
Since the tags list is created only once for multiple call to
notify_message functions.

src/core/service.c
src/core/unit.h

index b3c4ad73e5d6ea8593fe00151d2b1e10d5331831..6e2a82a2865055e8b1ea76237cf99a125a0748e8 100644 (file)
@@ -3847,7 +3847,7 @@ static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void
         return 0;
 }
 
-static bool service_notify_message_authorized(Service *s, pid_t pid, char **tags, FDSet *fds) {
+static bool service_notify_message_authorized(Service *s, pid_t pid, FDSet *fds) {
         assert(s);
 
         if (s->notify_access == NOTIFY_NONE) {
@@ -3894,19 +3894,19 @@ static void service_force_watchdog(Service *s) {
 static void service_notify_message(
                 Unit *u,
                 const struct ucred *ucred,
-                char **tags,
+                char * const *tags,
                 FDSet *fds) {
 
         Service *s = SERVICE(u);
         bool notify_dbus = false;
         const char *e;
-        char **i;
+        char * const *i;
         int r;
 
         assert(u);
         assert(ucred);
 
-        if (!service_notify_message_authorized(SERVICE(u), ucred->pid, tags, fds))
+        if (!service_notify_message_authorized(SERVICE(u), ucred->pid, fds))
                 return;
 
         if (DEBUG_LOGGING) {
index a4c342a396a4b227c508157ff123da10d679f1b4..4ad429bf30920911ecf7b75d478e421e7711e368 100644 (file)
@@ -539,7 +539,7 @@ typedef struct UnitVTable {
         void (*notify_cgroup_oom)(Unit *u);
 
         /* Called whenever a process of this unit sends us a message */
-        void (*notify_message)(Unit *u, const struct ucred *ucred, char **tags, FDSet *fds);
+        void (*notify_message)(Unit *u, const struct ucred *ucred, char * const *tags, FDSet *fds);
 
         /* Called whenever a name this Unit registered for comes or goes away. */
         void (*bus_name_owner_change)(Unit *u, const char *new_owner);