mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
mixer: Improve error messages
Use better diagnostic messages when unit numbers are wrong.
Reviewed by: arrowd@, christos@, kevans@
Approved by: christos@
Differential Revision: https://reviews.freebsd.org/D56845
(cherry picked from commit 9f5cfe625e)
This commit is contained in:
1 parent
3557da0355
commit
e8c1931941
1 file changed
+3
-1
@@ -71,7 +71,7 @@ main(int argc, char *argv[])
|
||||
errno = 0;
|
||||
dunit = strtol(optarg, NULL, 10);
|
||||
if (errno == EINVAL || errno == ERANGE)
|
||||
err(1, "strtol(%s)", optarg);
|
||||
err(1, "%s", strlen(optarg) ? optarg : "pcm");
|
||||
dflag = 1;
|
||||
break;
|
||||
case 'f':
|
||||
@@ -328,6 +328,8 @@ set_dunit(struct mixer *m, int dunit)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (dunit > mixer_get_nmixers())
|
||||
errx(1, "No such mixer unit: %d", dunit);
|
||||
if ((n = mixer_get_dunit()) < 0) {
|
||||
warn("cannot get default unit");
|
||||
return (-1);
|
||||
|
||||
Reference in new issue
Block a user