From nobody Fri Dec 19 09:19:25 2025 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 4dXhn95lVwz6LBP2 for ; Fri, 19 Dec 2025 09:19:25 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dXhn91tRyz44qQ for ; Fri, 19 Dec 2025 09:19:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766135965; 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=c1PYUu3WBFgGpH69i6Cn/jfcF25lQGUuzBJpi8FYDJA=; b=KBKqJ5QhumICgn4pBlPn5ubeqjqvZBMOlcq/xHZOH8qjH0By11cP24BjIOKM/jA/YERGl/ aHw1nQnsMuXgMlItvqyItXMgnnEMiFnPYOpHgbvUw0mQ8LH6iMAqjUJ/nNyx1muyP7mwSG 67e5LTttGawI+eSwIB9Bd4o04jYgz4zcX4ih0rnwj1WyXQhokHeRPsWIfEVIckBHiKGk5v v+4q4WJYgyu/RDJBvgvbDHRPFwiDsoiNiky5FCI/7vJaiRgtvzbESEWomkeuqUwy7oNuvl QM12njsHyGCz7TGTFQCd56PvIwTacCulmVYIQSa2TxBh6Umk6WHMYcwao7R+PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766135965; 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=c1PYUu3WBFgGpH69i6Cn/jfcF25lQGUuzBJpi8FYDJA=; b=KM95yx2pGgS3y9fpwUba1IRDHRJ5Vo8b9dDppVrULzx+5bGM7Yvw+ST2TowcOLt7j2WHat 0s0bhqosPiEP3ryZ7Jdwy8J9D60Jk+O2Rn0K7FVIqhepHQAzyks7NpeoMLlFQPCbd0t/B2 o7XFUAwmrf4pWtm1NaGPerGE/K91GWkrdzZoIHbdCVHGja+IieXEGAsXhhfvAI1SIvjwTW naT9pFSo1qkK56bN/5QCnzW3CNVXqQcPOXzf8t3ewmK9mynb4jwguVlkoep1/Q0ban3Bac gA4R/+ug9ccBx4g4X5MaqETqpwb/CKJwkL7q88J8QxuPFxTdEkUQc/Ya3dBxcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766135965; a=rsa-sha256; cv=none; b=kWvKvwjZkb/UT8DSan6PW2n8QOTqR8GBZgYHTq7pZyBsAZt9CWE2GT0vTckS3S1CdFFrSl PUrObgV7yvEEpbck/7MsfBdzhI3IKaxaaV/uF7LoeVCu6N6VdxkByVYHcmghHRQGdaumZ7 57iJGHXtFiHedIdj24J9YnW/0t6sfkZDYhXMWWvzp6zQAscUNyF902S87gMwgb2jWhA6Zx sQPBDThApLROhm7OqAz51osBB+Y6xtzbMPfcPFOyGDJuUCJlMuhC2ZtU8zRcZhEVPRf0of ObYBm5bLrmcSkKgjRhg9Q4+1EE0xX1IGe3g9A2gDUQb6q0pvX2pxi/GYzoxW5w== 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 4dXhn90c2nz1H2V for ; Fri, 19 Dec 2025 09:19:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3cddc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 19 Dec 2025 09:19:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 1dc4fa83bb8b - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 1dc4fa83bb8b78314cd24bbfda547edbfe2c7553 Auto-Submitted: auto-generated Date: Fri, 19 Dec 2025 09:19:25 +0000 Message-Id: <6945189d.3cddc.622fa6b3@gitrepo.freebsd.org> The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=1dc4fa83bb8b78314cd24bbfda547edbfe2c7553 commit 1dc4fa83bb8b78314cd24bbfda547edbfe2c7553 Author: Olivier Certner AuthorDate: 2025-11-14 11:59:09 +0000 Commit: Olivier Certner CommitDate: 2025-12-19 09:16:48 +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) {