From nobody Mon Feb 26 23:22:48 2024 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 4TkGqr6bYQz5BtYH; Mon, 26 Feb 2024 23:22:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TkGqr40jyz4VC0; Mon, 26 Feb 2024 23:22:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708989768; 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=HBIKBS0yfVP3w5J4ozHVjbWqTcnYYYIN63apJ6O+TLA=; b=oomUI0GPahqYefFh4Wlb5z4zLABTTHjsVoJtWv1Fjbc/FtFSedHzcHWRQ0z8SD1gKm3l4a MT36OXkJ42VDndjleiqGhDYNxAHA012wOkXhHyLwp4ARm8N5JzLsQlW66p8EE60y7s+g9I 8ZETSxFUapJ6lIjMkVySRb6+ObBFikTV4LYHYmSRBo7QJoWlkJPe+pABj3mZEsWr3x0lME OwpfEtQykvUku4WBRiYcydMia8ftUUQHm13RS5+W0rFAaZwVIPhMP5Ht0kQlS1Eumdherz kwA0lLWy6OCwOuNY7a2V7ZI3cZT3f5gAbOiQdytGJn5OLPpD2y4FxIWHyoHm6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708989768; a=rsa-sha256; cv=none; b=vOICql7/+cchxMfEbFOqd2Wn+aRSqx7MXtoqyU2/Zzqb0thT215eOuiENBmp5PhA8Xwbl2 9HDT/illd36NcvO3i5QQjF5cctraQy5UZ16nDSg5BmMqCBiHZYDUWcF5En9g7LwFNDLJ47 K6H3vcRvbxJ+82Vk+w7ZelpXy607ucbzeFUbYuIWW7ynTm3m4zgWsoZAjjDzhsiQzu7QY6 R0zryGui3JDolTC5kmFxZ6RqSpUVmBaF6/U09ClNORKlaTOXMlvVIPNNyIU8PiOQ8S3SDk lCQRXMgm1JrwTy4Hl8HjsLWmZWvAQmPdog27y5zYpjXKt6+elSzMjkJnYH3KsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708989768; 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=HBIKBS0yfVP3w5J4ozHVjbWqTcnYYYIN63apJ6O+TLA=; b=VbenGsisc42lcaLKqiLN4TUcU8UoiSZW88ixcCqrcTbBQq9jAiZuXQSugCrVXdz3/DjRuM mBYiVJV4EGXD0Ru/0dGMyS/slQPySwjA7JNN4XCbpZGX0oeB/bFIxbw7+KR3g4ZUXEz515 1cpAFkwBSXjih5rj6A0HARqsLOOFI/dkulqZ7rOzR45SgMNZRGGBwWpmyvnTQK5xBM/fdR oOFzhGzNqJ3SSphQEBBbBrwnrjM2fl9rEH2kHIDzwHNX8ETmaOeBJNxKRvVrX5b6s9IKe9 9SHpjrlfoI0HBtZ2gt9lLqZhS51SJXOGhrZrm37Zb4/gqBdup6DhMTbgXbDJDw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TkGqr3463znrK; Mon, 26 Feb 2024 23:22:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41QNMmXu028515; Mon, 26 Feb 2024 23:22:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41QNMmKL028512; Mon, 26 Feb 2024 23:22:48 GMT (envelope-from git) Date: Mon, 26 Feb 2024 23:22:48 GMT Message-Id: <202402262322.41QNMmKL028512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: 6ae4ed11c4d3 - stable/14 - mixer(8): Use new mixer if we change the default unit 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6ae4ed11c4d3f3c082e126eb9193ad535bf462ba Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6ae4ed11c4d3f3c082e126eb9193ad535bf462ba commit 6ae4ed11c4d3f3c082e126eb9193ad535bf462ba Author: Christos Margiolis AuthorDate: 2024-02-12 10:59:28 +0000 Commit: Christos Margiolis CommitDate: 2024-02-26 23:22:31 +0000 mixer(8): Use new mixer if we change the default unit If we use the -d option to change the default unit, close the current mixer and open the one we set as the default to avoid printing and applying changes (if any) to the old one. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D43809 (cherry picked from commit 5daa7cf42f4551cb2f4a452fd038807925320eac) --- usr.sbin/mixer/mixer.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index 83e97df19116..47d8e6359b73 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -118,8 +118,21 @@ main(int argc, char *argv[]) initctls(m); - if (dflag && set_dunit(m, dunit) < 0) - goto parse; + if (dflag) { + if (set_dunit(m, dunit) < 0) + goto parse; + else { + /* + * Open current mixer since we changed the default + * unit, otherwise we'll print and apply changes to the + * old one. + */ + (void)mixer_close(m); + if ((m = mixer_open(NULL)) == NULL) + errx(1, "cannot open default mixer"); + initctls(m); + } + } if (sflag) { printrecsrc(m, oflag); (void)mixer_close(m);