From: ratchov Date: Mon, 22 Apr 2024 10:49:01 +0000 (+0000) Subject: sndioctl: Remove assert about duplicate controls X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0bc434f8e2a749c656412a56e102ad1279879df5;p=openbsd sndioctl: Remove assert about duplicate controls On the sndiod(8) side device controls are not ordered. While switching from one device to another, a new control (of the new device) may appear before an old control with the same name is removed. As discussed in sioctl_open(3), once the full description increment is fetched (i.e. the call-back is invoked with NULL sioctl_desc structure) the representation of the control set is consistent. --- diff --git a/usr.bin/sndioctl/sndioctl.c b/usr.bin/sndioctl/sndioctl.c index a7f8e985735..2bda6e7b98a 100644 --- a/usr.bin/sndioctl/sndioctl.c +++ b/usr.bin/sndioctl/sndioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sndioctl.c,v 1.19 2023/01/31 21:38:01 ratchov Exp $ */ +/* $OpenBSD: sndioctl.c,v 1.20 2024/04/22 10:49:01 ratchov Exp $ */ /* * Copyright (c) 2014-2020 Alexandre Ratchov * @@ -879,12 +879,7 @@ ondesc(void *arg, struct sioctl_desc *d, int curval) */ for (pi = &infolist; (i = *pi) != NULL; pi = &i->next) { cmp = cmpdesc(d, &i->desc); - if (cmp == 0) { - fprintf(stderr, "fatal: duplicate control:\n"); - print_ent(i, "duplicate"); - exit(1); - } - if (cmp < 0) + if (cmp <= 0) break; } i = malloc(sizeof(struct info));