]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: move sysctl code to use PID_FMT
authorLennart Poettering <lennart@poettering.net>
Thu, 12 Sep 2024 15:46:12 +0000 (17:46 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 13 Sep 2024 05:28:51 +0000 (07:28 +0200)
Now that format-util.h doesn't pull in net/if.h anymore, we can use it
to format PIDs in the networkd-sysctl.c code.

src/network/networkd-sysctl.c

index d61c208f84013342f3a2994fcff81b8045282b55..4c83a6c9a9c5d33dab5db351e16deeadb53643d8 100644 (file)
@@ -9,6 +9,7 @@
 #include "af-list.h"
 #include "cgroup-util.h"
 #include "fd-util.h"
+#include "format-util.h"
 #include "missing_network.h"
 #include "networkd-link.h"
 #include "networkd-lldp-tx.h"
@@ -72,14 +73,14 @@ static int sysctl_event_handler(void *ctx, void *data, size_t data_sz) {
         if (!strneq(value, we->newvalue, sizeof(we->newvalue)))
                 log_struct(LOG_WARNING,
                            "MESSAGE_ID=" SD_MESSAGE_SYSCTL_CHANGED_STR,
-                           "OBJECT_PID=%d", we->pid,
+                           "OBJECT_PID=" PID_FMT, we->pid,
                            "OBJECT_COMM=%s", we->comm,
-                           "SYSCTL=/proc/sys/%s", we->path,
+                           "SYSCTL=%s", path,
                            "OLDVALUE=%s", we->current,
                            "NEWVALUE=%s", we->newvalue,
                            "OURVALUE=%s", value,
-                           LOG_MESSAGE("Foreign process '%s[%d]' changed sysctl '/proc/sys/%s' from '%s' to '%s', conflicting with our setting to '%s'",
-                                       we->comm, we->pid, we->path, we->current, we->newvalue, value));
+                           LOG_MESSAGE("Foreign process '%s[" PID_FMT "]' changed sysctl '%s' from '%s' to '%s', conflicting with our setting to '%s'.",
+                                       we->comm, we->pid, path, we->current, we->newvalue, value));
 
         return 0;
 }