Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/audio/ctl Remove -p option. AUDIO_SETCHAN is insecu...



details:   https://anonhg.NetBSD.org/src/rev/8a6b6450adaf
branches:  trunk
changeset: 451174:8a6b6450adaf
user:      isaki <isaki%NetBSD.org@localhost>
date:      Wed May 08 14:44:42 2019 +0000

description:
Remove -p option.  AUDIO_SETCHAN is insecure and is obsoleted.

diffstat:

 usr.bin/audio/ctl/audioctl.1 |  16 ++++------------
 usr.bin/audio/ctl/ctl.c      |  25 ++++++-------------------
 2 files changed, 10 insertions(+), 31 deletions(-)

diffs (138 lines):

diff -r f9ac97a43f87 -r 8a6b6450adaf usr.bin/audio/ctl/audioctl.1
--- a/usr.bin/audio/ctl/audioctl.1      Wed May 08 14:36:12 2019 +0000
+++ b/usr.bin/audio/ctl/audioctl.1      Wed May 08 14:44:42 2019 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: audioctl.1,v 1.21 2017/02/10 19:31:42 nat Exp $
+.\" $NetBSD: audioctl.1,v 1.22 2019/05/08 14:44:42 isaki Exp $
 .\"
 .\" Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,17 +35,14 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl d Ar device
-.Op Fl p Ar channel
 .Op Fl n
 .Fl a
 .Nm
 .Op Fl d Ar device
-.Op Fl p Ar channel
 .Op Fl n
 .Ar name ...
 .Nm
 .Op Fl d Ar device
-.Op Fl p Ar channel
 .Op Fl n
 .Fl w
 .Ar name=value ...
@@ -71,11 +68,6 @@
 .Pa /dev/audioctl0 .
 .Pp
 The
-.Fl p
-flag can be used to give a virtual channel to control, the default is a new
-channel.
-.Pp
-The
 .Fl n
 flag suppresses printing of the variable name.
 .Sh ENVIRONMENT
@@ -93,10 +85,10 @@
 audio I/O device (does not reset on open)
 .El
 .Sh EXAMPLES
-To set the playing sampling rate to 11025, for the channel 3 you can use
-.Dl audioctl -p 3 -w play.sample_rate=11025
+To set the playing sampling rate to 11025, you can use
+.Dl audioctl -w play.sample_rate=11025
 To set all of the play parameters for CD-quality audio, you can use
-.Dl audioctl -p 3 -w play=44100,2,16,slinear_le
+.Dl audioctl -w play=44100,2,16,slinear_le
 Note that many of the variables that can be inspected and changed with
 .Nm
 are reset when
diff -r f9ac97a43f87 -r 8a6b6450adaf usr.bin/audio/ctl/ctl.c
--- a/usr.bin/audio/ctl/ctl.c   Wed May 08 14:36:12 2019 +0000
+++ b/usr.bin/audio/ctl/ctl.c   Wed May 08 14:44:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ctl.c,v 1.43 2017/03/21 07:04:29 nat Exp $     */
+/*     $NetBSD: ctl.c,v 1.44 2019/05/08 14:44:42 isaki Exp $   */
 
 /*
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: ctl.c,v 1.43 2017/03/21 07:04:29 nat Exp $");
+__RCSID("$NetBSD: ctl.c,v 1.44 2019/05/08 14:44:42 isaki Exp $");
 #endif
 
 
@@ -66,7 +66,6 @@
 
 static int properties, fullduplex, rerror;
 
-int channel;
 int verbose;
 
 static struct field {
@@ -291,9 +290,6 @@
 {
        int pos, i;
 
-       if (channel >= 0 && ioctl(fd, AUDIO_SETCHAN, &channel) < 0)
-               err(1, "AUDIO_SETCHAN");
-
        if (ioctl(fd, AUDIO_GETDEV, &adev) < 0)
                err(1, "AUDIO_GETDEV");
        for (pos = 0, i = 0; ; i++) {
@@ -326,11 +322,9 @@
 {
        const char *prog = getprogname();
 
-       fprintf(stderr, "Usage: %s [-d file] [-p] channel "
-                       "[-n] name ...\n", prog);
-       fprintf(stderr, "Usage: %s [-d file] [-p] channel [-n] "
-                       "-w name=value ...\n", prog);
-       fprintf(stderr, "Usage: %s [-d file] [-p] channel [-n] -a\n", prog);
+       fprintf(stderr, "Usage: %s [-d file] [-n] name ...\n", prog);
+       fprintf(stderr, "Usage: %s [-d file] [-n] -w name=value ...\n", prog);
+       fprintf(stderr, "Usage: %s [-d file] [-n] -a\n", prog);
        exit(1);
 }
 
@@ -343,12 +337,11 @@
        const char *file;
        const char *sep = "=";
 
-       channel = -1;
        file = getenv("AUDIOCTLDEVICE");
        if (file == NULL)
                file = deffile;
 
-       while ((ch = getopt(argc, argv, "ad:f:np:w")) != -1) {
+       while ((ch = getopt(argc, argv, "ad:f:nw")) != -1) {
                switch(ch) {
                case 'a':
                        aflag++;
@@ -359,9 +352,6 @@
                case 'n':
                        sep = 0;
                        break;
-               case 'p':
-                       channel = atoi(optarg);
-                       break;
                case 'f': /* compatibility */
                case 'd':
                        file = optarg;
@@ -440,9 +430,6 @@
 {
        struct field *p;
 
-       if (channel >= 0 && ioctl(fd, AUDIO_SETCHAN, &channel) < 0)
-               err(1, "AUDIO_SETCHAN");
-
        AUDIO_INITINFO(&info);
        while (argc--) {
                char *q;



Home | Main Index | Thread Index | Old Index