From 2348237f059ddb8ff4bc255235766771e1af3dd1 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 23 Sep 2025 10:46:59 +0200 Subject: [PATCH] liblastlog2: fix operator precedence in conditional assignments Fix operator precedence in ll2_rename_user() where != comparison was taking precedence over assignment, causing retval to be assigned 0 or 1 instead of the actual function return value. Fixes: https://github.com/util-linux/util-linux/issues/3756 Signed-off-by: Karel Zak --- liblastlog2/src/lastlog2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/liblastlog2/src/lastlog2.c b/liblastlog2/src/lastlog2.c index 020c77106..f285dddb4 100644 --- a/liblastlog2/src/lastlog2.c +++ b/liblastlog2/src/lastlog2.c @@ -519,12 +519,12 @@ ll2_rename_user(struct ll2_context *context, const char *user, if ((retval = open_database_rw(context, &db, error)) != 0) return retval; - if ((retval = read_entry(db, user, &ll_time, &tty, &rhost, &pam_service, error) != 0)) { + if ((retval = read_entry(db, user, &ll_time, &tty, &rhost, &pam_service, error)) != 0) { sqlite3_close(db); return retval; } - if ((retval = write_entry(db, newname, ll_time, tty, rhost, pam_service, error) != 0)) { + if ((retval = write_entry(db, newname, ll_time, tty, rhost, pam_service, error)) != 0) { sqlite3_close(db); free(tty); free(rhost); -- 2.47.3