From nobody Mon Feb 26 23:22:43 2024 X-Original-To: dev-commits-src-branches@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 4TkGqm24qSz5BtbK; Mon, 26 Feb 2024 23:22:44 +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 4TkGqm0FdDz4TbS; Mon, 26 Feb 2024 23:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708989764; 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=9psMrBTk69uwzaYWAuQDJotDsjMsLBw+I+KEEfye8So=; b=dVUywCoM9E+9sE1cDPW9GwYQhqFSTnnuNMVyMH4d/7b1mWzcIDPQlis5z9mG9SrbA6l6de ZkvX6uvt/lOLtWpnmpyp4mRNQZDSpVoP6VINY7A6ff1Ebge9OWe2Czhu7achs2aqWgfm0L 7AK7q3wv7ohoLV9v9tILLf32A52T/oFE1a7ovk+GwK+MEhee7yrNExASm5PPpJtk8e9g/F 8BH6HyRG1OODgFsXmH1yZIhtMb/czSw+jM/djIC5V7eHHy8Kvin3Xeaj462pm8sCMIkfsl Qnx2V26UwO0bbj91kvz3BptztjyM6zdmctZsKROoXtkGHbKx5aQ5VCNxipOixg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708989764; a=rsa-sha256; cv=none; b=tW7xoxL91PPWJq2Yg9ngZL9YrnQrn1SvXKDP+Us2Vd/zA20OaJ/85FLN0+Vn1GKANJz1F5 NoPtx68BToTZikhGeZTiqpoH2WW/WqRMmSBBnEXSCKcZsJsf+aSwjGz4UDPmjpRegDwRjN eXZUNAD9ld3X87dfZ7vEgiO/j1vFZH/BUT/Q0+xRjJyc+WOZSevkC6oVW1xzwyr8P1XSUo Pxa8UFIPe9P+os+rWJ7KRV3kF5DwSvKy9Wf1K8Ci+TiRdxVDw/tqZd8i66qJTHv9YB/Y3C pNELAa10JsUszaGNs+wRrJNzURIBhl3/dpq2ulaFPsnVU5ycJWPG2VWjuBWR6w== 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=1708989764; 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=9psMrBTk69uwzaYWAuQDJotDsjMsLBw+I+KEEfye8So=; b=A1AbEdC3PWa42+Urh4U85rSjHHb8t6hxrrOUz9ysldqxKimYw5ecIwamCy00+rWrM2iPxc SnuA6RRr6wyhllgFCU/ON9klVVpjoNJv0KVQ4UuHsK1hhDn1pO8I0xv9cInpx1bgl4+mUg 1rYX1RcK4VArfLAFRpFf6YqDL0U4MGufzQ6/8r08WJNBvp1Zfv6jTbLobt4j3mfkaSddSV M7vFEU0oq4Zef++NCePezhwgpj4gRh9+Zn2Ll+Vy9GwHfQTdeho7QZFHlHSbdYyNcv8Uzu LGGBWIK9+OVVU3BZLh1rVHVfhHz5rPFJYRT8oG/axV/P58nI9O+pU1nKUJEAig== 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 4TkGql6QYjznnD; Mon, 26 Feb 2024 23:22:43 +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 41QNMh0Q028302; Mon, 26 Feb 2024 23:22:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41QNMh90028299; Mon, 26 Feb 2024 23:22:43 GMT (envelope-from git) Date: Mon, 26 Feb 2024 23:22:43 GMT Message-Id: <202402262322.41QNMh90028299@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: 750a5298fee0 - stable/14 - mixer(8): Improve error messsages and warnings List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: 750a5298fee0bd38bf5c9ec98554e2e3617b0294 Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=750a5298fee0bd38bf5c9ec98554e2e3617b0294 commit 750a5298fee0bd38bf5c9ec98554e2e3617b0294 Author: Christos Margiolis AuthorDate: 2024-02-12 10:58:55 +0000 Commit: Christos Margiolis CommitDate: 2024-02-26 23:22:30 +0000 mixer(8): Improve error messsages and warnings No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: dev_submerge.ch, imp Differential Revision: https://reviews.freebsd.org/D43793 (cherry picked from commit 09ba07011a627e3ea05e0be8ee6db76fd2371540) --- usr.sbin/mixer/mixer.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index bb868fb5ca9b..043c8c412857 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -66,9 +66,10 @@ main(int argc, char *argv[]) aflag = 1; break; case 'd': + errno = 0; dunit = strtol(optarg, NULL, 10); if (errno == EINVAL || errno == ERANGE) - err(1, "strtol"); + err(1, "strtol(%s)", optarg); dflag = 1; break; case 'f': @@ -92,11 +93,11 @@ main(int argc, char *argv[]) /* Print all mixers and exit. */ if (aflag) { if ((n = mixer_get_nmixers()) < 0) - err(1, "mixer_get_nmixers"); + errx(1, "no mixers present in the system"); for (i = 0; i < n; i++) { (void)snprintf(buf, sizeof(buf), "/dev/mixer%d", i); if ((m = mixer_open(buf)) == NULL) - err(1, "mixer_open: %s", buf); + errx(1, "%s: no such mixer", buf); initctls(m); if (sflag) printrecsrc(m, oflag); @@ -111,7 +112,7 @@ main(int argc, char *argv[]) } if ((m = mixer_open(name)) == NULL) - err(1, "mixer_open: %s", name); + errx(1, "%s: no such mixer", name); initctls(m); @@ -212,7 +213,7 @@ initctls(struct mixer *m) } if (rc) { (void)mixer_close(m); - err(1, "cannot make controls"); + errx(1, "cannot make mixer controls"); } } @@ -315,7 +316,7 @@ set_dunit(struct mixer *m, int dunit) return (-1); } if (mixer_set_dunit(m, dunit) < 0) { - warn("cannot set default unit to: %d", dunit); + warn("cannot set default unit to %d", dunit); return (-1); } printf("default_unit: %d -> %d\n", n, dunit);