From de12b8d163c656a2ccfc0634b7f0d7321515c905 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Fri, 17 May 2024 17:35:43 +0800 Subject: [PATCH] core/execute: do not use format str for log_object_internal This reverts part of 210ca71cb5d9f41df3b23eef28d6742bd90a0362. Another fallout from that commit... Fixes #32877 --- src/core/execute.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/execute.h b/src/core/execute.h index a2e3e57e3b..107ae25243 100644 --- a/src/core/execute.h +++ b/src/core/execute.h @@ -624,11 +624,6 @@ bool exec_needs_ipc_namespace(const ExecContext *context); #define LOG_EXEC_INVOCATION_ID_FIELD_FORMAT(ep) \ ((ep)->runtime_scope == RUNTIME_SCOPE_USER ? "USER_INVOCATION_ID=%s" : "INVOCATION_ID=%s") -/* Like LOG_MESSAGE(), but with the unit name prefixed. */ -#define LOG_EXEC_MESSAGE(ep, fmt, ...) LOG_MESSAGE("%s: " fmt, (ep)->unit_id, ##__VA_ARGS__) -#define LOG_EXEC_ID(ep) LOG_EXEC_ID_FIELD_FORMAT(ep), (ep)->unit_id -#define LOG_EXEC_INVOCATION_ID(ep) LOG_EXEC_INVOCATION_ID_FIELD_FORMAT(ep), (ep)->invocation_id_string - #define log_exec_full_errno_zerook(ec, ep, level, error, ...) \ ({ \ const ExecContext *_c = (ec); \ @@ -641,8 +636,10 @@ bool exec_needs_ipc_namespace(const ExecContext *context); !_do_log ? -ERRNO_VALUE(error) : \ log_object_internal(_l, error, \ PROJECT_FILE, __LINE__, __func__, \ - LOG_EXEC_ID(_p), \ - LOG_EXEC_INVOCATION_ID(_p), \ + LOG_EXEC_ID_FIELD(_p), \ + _p->unit_id, \ + LOG_EXEC_INVOCATION_ID_FIELD(_p), \ + _p->invocation_id_string, \ ##__VA_ARGS__); \ }) @@ -667,6 +664,11 @@ bool exec_needs_ipc_namespace(const ExecContext *context); #define log_exec_warning_errno(ec, ep, error, ...) log_exec_full_errno(ec, ep, LOG_WARNING, error, __VA_ARGS__) #define log_exec_error_errno(ec, ep, error, ...) log_exec_full_errno(ec, ep, LOG_ERR, error, __VA_ARGS__) +/* Like LOG_MESSAGE(), but with the unit name prefixed. */ +#define LOG_EXEC_MESSAGE(ep, fmt, ...) LOG_MESSAGE("%s: " fmt, (ep)->unit_id, ##__VA_ARGS__) +#define LOG_EXEC_ID(ep) LOG_EXEC_ID_FIELD_FORMAT(ep), (ep)->unit_id +#define LOG_EXEC_INVOCATION_ID(ep) LOG_EXEC_INVOCATION_ID_FIELD_FORMAT(ep), (ep)->invocation_id_string + #define log_exec_struct_errno(ec, ep, level, error, ...) \ ({ \ const ExecContext *_c = (ec); \ -- 2.25.1