Date: Sun, 28 Jun 2026 18:40:23 +0000 From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: f34a21ba0ada - stable/15 - nuageinit: remove dead checkgroup(), inline check in purge_group() Message-ID: <6a416a97.1cd40.789f38cd@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=f34a21ba0ada7ddfcce2ba382d2000f030ef21f5 commit f34a21ba0ada7ddfcce2ba382d2000f030ef21f5 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-06-04 18:32:48 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-06-28 18:32:24 +0000 nuageinit: remove dead checkgroup(), inline check in purge_group() Call getgroups() once instead of N times per call. Inline the membership check directly, removing the now-unused checkgroup() helper function. (cherry picked from commit 852504a5fa5eb6b4dea98bd7abdb89f1c7bab2b0) --- libexec/nuageinit/nuage.lua | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua index a491ca8d9df6..c443d6711b14 100644 --- a/libexec/nuageinit/nuage.lua +++ b/libexec/nuageinit/nuage.lua @@ -200,23 +200,19 @@ local function getgroups() return splitlines(groups) end -local function checkgroup(group) - local groups = getgroups() - - for _, group2chk in ipairs(groups) do - if group == group2chk then - return true - end - end - - return false -end - local function purge_group(groups) + local existing = getgroups() local ret = {} for _, group in ipairs(groups) do - if checkgroup(group) then + local found = false + for _, eg in ipairs(existing) do + if group == eg then + found = true + break + end + end + if found then ret[#ret + 1] = group else warnmsg("ignoring non-existent group '" .. group .. "'")home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a416a97.1cd40.789f38cd>
