]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: ignore return of audit_log_acct_message
authorThomas Weißschuh <thomas@t-8ch.de>
Fri, 19 Jan 2024 02:12:21 +0000 (03:12 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Fri, 19 Jan 2024 02:12:21 +0000 (03:12 +0100)
The function is marked with `warn_unused_result` so handle the return
value. Failures of `audit_open()` are also silently ignored so do the
same for `audit_log_acct_message()` itself.

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

index 552cafbfb1df2998278f12cfc7dcba77275084b7..c8544f6a17cd3e58e73683ade859006e8e596c43 100644 (file)
@@ -645,16 +645,16 @@ static void log_audit(struct login_context *cxt, int status)
        if (!pwd && cxt->username)
                pwd = getpwnam(cxt->username);
 
-       audit_log_acct_message(audit_fd,
-                              AUDIT_USER_LOGIN,
-                              NULL,
-                              "login",
-                              cxt->username ? cxt->username : "(unknown)",
-                              pwd ? pwd->pw_uid : (unsigned int)-1,
-                              cxt->hostname,
-                              NULL,
-                              cxt->tty_name,
-                              status);
+       ignore_result( audit_log_acct_message(audit_fd,
+                                             AUDIT_USER_LOGIN,
+                                             NULL,
+                                             "login",
+                                             cxt->username ? cxt->username : "(unknown)",
+                                             pwd ? pwd->pw_uid : (unsigned int)-1,
+                                             cxt->hostname,
+                                             NULL,
+                                             cxt->tty_name,
+                                             status) );
 
        close(audit_fd);
 }