From: Zbigniew Jędrzejewski-Szmek Date: Wed, 8 Feb 2023 10:36:22 +0000 (+0100) Subject: manager: improve message about Reload/Reexec requests X-Git-Tag: v253-rc3~22^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1980a25dc03aa500d4ee2725d696f68d265cd4ca;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 53121fa1a6b..c4f205bc423 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) {