sysusers: log new group name on write failure

When adding new groups, putgrent_with_members() is called with the newly
constructed group n, but the error path logs gr->gr_name. gr belongs to
the
earlier loop over the existing group file and may be NULL after EOF.

Log n.gr_name instead.

Found by Linux Verification Center (linuxtesting.org) with Svace.
This commit is contained in:
Mikhail Nogin
2026-05-26 02:21:50 +09:00
committed by Yu Watanabe
parent 9e4248fbbf
commit f50c3f548b
+1 -1
View File
@@ -821,7 +821,7 @@ static int write_temporary_group(
r = putgrent_with_members(c, &n, group);
if (r < 0)
return log_error_errno(r, "Failed to add new group \"%s\" to temporary group file: %m",
gr->gr_name);
n.gr_name);
group_changed = true;
}