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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user