]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: handle failure of audit_log_user_message
authorThomas Weißschuh <thomas@t-8ch.de>
Fri, 19 Jan 2024 02:11:22 +0000 (03:11 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Fri, 19 Jan 2024 02:12:05 +0000 (03:12 +0100)
The function is marked was `warn_unused_result`, so do something with
the return value.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
sys-utils/hwclock.c

index 7002708af21379048677d1df064f8c5b0ae0ec56..af71a9a4b3a63541e3d1cb092e9a4d6402ec9df4 100644 (file)
@@ -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