41 lines
1.7 KiB
Diff
41 lines
1.7 KiB
Diff
|
|
From 1980a25dc03aa500d4ee2725d696f68d265cd4ca Mon Sep 17 00:00:00 2001
|
||
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||
|
|
Date: Wed, 8 Feb 2023 11:36:22 +0100
|
||
|
|
Subject: [PATCH] manager: improve message about Reload/Reexec requests
|
||
|
|
|
||
|
|
If we fail to get the necessary information, let's just not print that
|
||
|
|
part of the message. 'n/a' looks pretty ugly.
|
||
|
|
|
||
|
|
I used a bunch of ternary operators instead of seperate log lines because
|
||
|
|
with two components that might or might not be there, we need four different
|
||
|
|
combinations.
|
||
|
|
|
||
|
|
Also, the unit name doesn't need to be quoted, it's always printable.
|
||
|
|
|
||
|
|
Conflict:NA
|
||
|
|
Reference:https://github.com/systemd/systemd/commit/1980a25dc03aa500d4ee2725d696f68d265cd4ca
|
||
|
|
---
|
||
|
|
src/core/dbus-manager.c | 6 ++++--
|
||
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
|
||
|
|
index 53121fa1a6..c4f205bc42 100644
|
||
|
|
--- a/src/core/dbus-manager.c
|
||
|
|
+++ b/src/core/dbus-manager.c
|
||
|
|
@@ -1527,8 +1527,10 @@ static void log_caller(sd_bus_message *message, Manager *manager, const char *me
|
||
|
|
(void) sd_bus_creds_get_comm(creds, &comm);
|
||
|
|
caller = manager_get_unit_by_pid(manager, pid);
|
||
|
|
|
||
|
|
- log_info("%s requested from client PID " PID_FMT " ('%s') (from unit '%s')...",
|
||
|
|
- method, pid, strna(comm), strna(caller ? caller->id : NULL));
|
||
|
|
+ log_info("%s requested from client PID " PID_FMT "%s%s%s%s%s%s...",
|
||
|
|
+ method, pid,
|
||
|
|
+ comm ? " ('" : "", strempty(comm), comm ? "')" : "",
|
||
|
|
+ caller ? " (unit " : "", caller ? caller->id : NULL, caller ? ")" : "");
|
||
|
|
}
|
||
|
|
|
||
|
|
static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|