From: Thomas Weißschuh Date: Fri, 19 Jan 2024 02:11:22 +0000 (+0100) Subject: hwclock: handle failure of audit_log_user_message X-Git-Tag: v2.40-rc1~39^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8531c8bc5389a139d80f54abc4c1f12889d3d895;p=thirdparty%2Futil-linux.git hwclock: handle failure of audit_log_user_message The function is marked was `warn_unused_result`, so do something with the return value. Signed-off-by: Thomas Weißschuh --- 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