66 lines
2.9 KiB
Diff
66 lines
2.9 KiB
Diff
From 4895bacccb1bf607ecfd341027399c6f924bdf07 Mon Sep 17 00:00:00 2001
|
|
From: Luca Boccassi <bluca@debian.org>
|
|
Date: Thu, 15 Dec 2022 12:20:28 +0000
|
|
Subject: [PATCH] Manager: also log caller of daemon-reexec
|
|
|
|
Conflict:Conflict:code context adaptation
|
|
Reference:https://github.com/systemd/systemd/commit/4895bacccb1bf607ecfd341027399c6f924bdf07
|
|
---
|
|
src/core/dbus-manager.c | 12 ++++++++----
|
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
|
|
index 79e96f948c..f01c67ecf1 100644
|
|
--- a/src/core/dbus-manager.c
|
|
+++ b/src/core/dbus-manager.c
|
|
@@ -1451,7 +1451,7 @@ int verify_run_space_and_log(const char *message) {
|
|
return 0;
|
|
}
|
|
|
|
-static void log_reload_caller(sd_bus_message *message, Manager *manager) {
|
|
+static void log_caller(sd_bus_message *message, Manager *manager, const char *method) {
|
|
_cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
|
|
const char *comm = NULL;
|
|
Unit *caller;
|
|
@@ -1459,6 +1459,7 @@ static void log_reload_caller(sd_bus_message *message, Manager *manager) {
|
|
|
|
assert(message);
|
|
assert(manager);
|
|
+ assert(method);
|
|
|
|
if (sd_bus_query_sender_creds(message, SD_BUS_CREDS_PID|SD_BUS_CREDS_AUGMENT|SD_BUS_CREDS_COMM, &creds) < 0)
|
|
return;
|
|
@@ -1470,8 +1471,8 @@ static void log_reload_caller(sd_bus_message *message, Manager *manager) {
|
|
(void) sd_bus_creds_get_comm(creds, &comm);
|
|
caller = manager_get_unit_by_pid(manager, pid);
|
|
|
|
- log_info("Reloading requested from client PID " PID_FMT " ('%s') (from unit '%s')...",
|
|
- pid, strna(comm), strna(caller ? caller->id : NULL));
|
|
+ log_info("%s requested from client PID " PID_FMT " ('%s') (from unit '%s')...",
|
|
+ method, pid, strna(comm), strna(caller ? caller->id : NULL));
|
|
}
|
|
|
|
static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
|
@@ -1495,7 +1496,7 @@ static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error *
|
|
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
|
|
|
/* Write a log message noting the unit or process who requested the Reload() */
|
|
- log_reload_caller(message, m);
|
|
+ log_caller(message, m, "Reloading");
|
|
|
|
/* Instead of sending the reply back right away, we just
|
|
* remember that we need to and then send it after the reload
|
|
@@ -1540,6 +1541,9 @@ static int method_reexecute(sd_bus_message *message, void *userdata, sd_bus_erro
|
|
if (r == 0)
|
|
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
|
|
|
+ /* Write a log message noting the unit or process who requested the Reexecute() */
|
|
+ log_caller(message, m, "Reexecuting");
|
|
+
|
|
/* We don't send a reply back here, the client should
|
|
* just wait for us disconnecting. */
|
|
|
|
--
|
|
2.33.0
|
|
|