From 8531c8bc5389a139d80f54abc4c1f12889d3d895 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Fri, 19 Jan 2024 03:11:22 +0100 Subject: [PATCH] hwclock: handle failure of audit_log_user_message MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The function is marked was `warn_unused_result`, so do something with the return value. Signed-off-by: Thomas Weißschuh --- sys-utils/hwclock.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 7002708af2..af71a9a4b3 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1623,10 +1623,14 @@ hwclock_exit(const struct hwclock_control *ctl , int status) { #ifdef HAVE_LIBAUDIT + int ret; + if (ctl->hwaudit_on && !ctl->testing) { - audit_log_user_message(hwaudit_fd, AUDIT_USYS_CONFIG, - "op=change-system-time", NULL, NULL, NULL, - status == EXIT_SUCCESS ? 1 : 0); + ret = audit_log_user_message(hwaudit_fd, AUDIT_USYS_CONFIG, + "op=change-system-time", NULL, NULL, NULL, + status == EXIT_SUCCESS ? 1 : 0); + if (ret == -1) + warn(_("could not send audit message")); } close(hwaudit_fd); #endif -- 2.47.3