networkd: move sysctl code to use PID_FMT

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.
This commit is contained in:
Lennart Poettering
2024-09-13 07:28:51 +02:00
parent 868258cf38
commit a44fa55e26
+5 -4
View 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;
}