Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/audiocfg Check mode argument earlier.



details:   https://anonhg.NetBSD.org/src/rev/752898e63228
branches:  trunk
changeset: 964964:752898e63228
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Aug 24 05:51:06 2019 +0000

description:
Check mode argument earlier.

diffstat:

 usr.bin/audiocfg/audiodev.c |  7 +------
 usr.bin/audiocfg/main.c     |  5 ++++-
 2 files changed, 5 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r cb97c354122e -r 752898e63228 usr.bin/audiocfg/audiodev.c
--- a/usr.bin/audiocfg/audiodev.c       Sat Aug 24 05:45:24 2019 +0000
+++ b/usr.bin/audiocfg/audiodev.c       Sat Aug 24 05:51:06 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.10 2019/08/24 05:45:24 isaki Exp $ */
+/* $NetBSD: audiodev.c,v 1.11 2019/08/24 05:51:06 isaki Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -282,11 +282,6 @@
                ai.record.sample_rate = freq;
        }
 
-       if (setmode == 0) {
-               errno = EINVAL;
-               return -1;
-       }
-
        ai.mode = setmode;
        printf("setting %s to %s:%u, %uch, %uHz\n",
            adev->xname, encname, prec, ch, freq);
diff -r cb97c354122e -r 752898e63228 usr.bin/audiocfg/main.c
--- a/usr.bin/audiocfg/main.c   Sat Aug 24 05:45:24 2019 +0000
+++ b/usr.bin/audiocfg/main.c   Sat Aug 24 05:51:06 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.12 2019/08/24 05:45:25 isaki Exp $ */
+/* $NetBSD: main.c,v 1.13 2019/08/24 05:51:06 isaki Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -222,6 +222,9 @@
                        else
                                usage(argv[0]);
                }
+               if (mode == 0)
+                       usage(argv[0]);
+                       /* NOTREACHED */
                enc = argv[4];
                prec = strtoul(argv[5], NULL, 10);
                if (errno)



Home | Main Index | Thread Index | Old Index