From nobody Tue Jan 6 13:34:27 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dlsb75Tqdz6NdbB for ; Tue, 06 Jan 2026 13:34:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dlsb73kc0z3T2q for ; Tue, 06 Jan 2026 13:34:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767706467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WUEvZrFuya6x1xngPffPIt+mZTKYm/8hmVhOK3ykS6s=; b=gFWbUYJIInJtUntjh7mBDAF+aJ7xOhn0KywKyxuDW9DoeHP48My6n8XKbiu+SZqf06git0 1mkOXB8/o7B5TwUyvFtY42yhKrOZk98wbMxE+oATRMhqwuvC35apGfs7izq+y+mT1PdjJL bmSmqGJ0hR+OoVpK8pNsJcC9SjP5aEe5IduwwtxyeUXvDjCqJ1nW4fkvIDG5sE66etZTOX O9Csk30NcHkMaZfXDIGEeIJvKJfKNkXKWcLs8JF1fgCVy9Kcxt8wUiL5T3ci/AnAm4Chrz v50mGtfOuYCUYpCOYplqOWqsvfRuzwqnr1VLsizTpK4LLQNYYBDTPWSDWr7U/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767706467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WUEvZrFuya6x1xngPffPIt+mZTKYm/8hmVhOK3ykS6s=; b=SLlkERrKNUR1UzAeO2BkPPh7bZnY9hb9WaPM5+OimLbAmuB5W35ZXpFB+sjx7648QEa7Hi CPRqEbfIbgeOQx5AZse/8hNDoXmiXYpkp9L3F21Sz+o6o+gTL2xEWP3ftXSeM8l+VS73yx FsOGe7ON8CJpHoWDzZO6QfAb9bPgkmROuoHk3lgooHTE6gAR1dklBNm2SvZZmjz+6TWu0x 7TDjyQ+X2BaZesdFvlsiTDaNkXtYcWcUZmVNxYnwHK8PfBp6fQaWBz/nGeAJRms6KlAjS/ ILTW/LhumoqY6VNIISfDNM2EParnG5nfEeviy5yOs36n+I94XFaihnWZ4hM2lw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767706467; a=rsa-sha256; cv=none; b=UyZhQkxtDBJN6tGYJuRrdVPzGpHk7GWHk1l9tO5QO/AKCFiD213d3nR9TKHOdpkLHr4VMb E7GOA59dVmBVMSPBfrxenWuKIPpKbe8V6D18w7dwJRzY4E5lBnYowHccMkaf1Or+t4ohH8 FLtGxwxSMO96rM5+k7kmIi+ehMBS4JR070YbGvuYiPa0t/yjfvcPrHiiHpVyiynJAhdKkj 544tA6jTq0EN6UZ2lJjYWSNkKCpPCQNZRl1cNI4UyWQX6sAlB4X1iKQuWxG2OtU2yXYsnB xJYnstugu7pJDBQ1psnOzFNfL4gZuvd4bZ7whgpSo7IeMydQhsQ9FEXdwG6b6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dlsb735ybz17XF for ; Tue, 06 Jan 2026 13:34:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f493 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 06 Jan 2026 13:34:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: c286220e732f - stable/15 - mdo(1): Avoid calling getgroups() in some unnecessary cases List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: c286220e732f9e55d3782874121f1efb6a81f45e Auto-Submitted: auto-generated Date: Tue, 06 Jan 2026 13:34:27 +0000 Message-Id: <695d0f63.3f493.30230cb7@gitrepo.freebsd.org> The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c286220e732f9e55d3782874121f1efb6a81f45e commit c286220e732f9e55d3782874121f1efb6a81f45e Author: Olivier Certner AuthorDate: 2025-11-14 11:59:09 +0000 Commit: Olivier Certner CommitDate: 2026-01-06 13:33:24 +0000 mdo(1): Avoid calling getgroups() in some unnecessary cases If the basis for supplementary groups are the current ones, we do not need to fetch them when they are to be replaced entirely (which we already have been doing), as in the '!start_from_current_groups' case, but specifically also when they are not going to be touched at all. This change in passing makes the modified code block's comment saying that SETCREDF_SUPP_GROUPS need not be set here correct. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53771 (cherry picked from commit b92b1b47583036bd02e656564ff22c92b8949077) --- usr.bin/mdo/mdo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.bin/mdo/mdo.c b/usr.bin/mdo/mdo.c index 3eb5d4e5c23f..879423bc0128 100644 --- a/usr.bin/mdo/mdo.c +++ b/usr.bin/mdo/mdo.c @@ -753,8 +753,14 @@ main(int argc, char **argv) */ setcred_flags |= SETCREDF_SUPP_GROUPS; } - } else if (supp_groups_str == NULL && (supp_mod_str == NULL || - supp_mod_str[0] != '@')) { + } else if (supp_groups_str == NULL && supp_mod_str != NULL && + supp_mod_str[0] != '@') { + /* + * We do not need to determine the current groups if, as for the + * '!start_from_current_groups' case, we are going to replace + * them entirely, but here also if we do not amend them at all + * (because they are by definition already in place). + */ const int ngroups = getgroups(0, NULL); if (ngroups > 0) {