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/86e98b2bf3bf
branches:  trunk
changeset: 453723:86e98b2bf3bf
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 c53fad47bb02 -r 86e98b2bf3bf 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 c53fad47bb02 -r 86e98b2bf3bf 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