=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndiod/dev.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- src/usr.bin/sndiod/dev.c 2019/07/10 14:22:52 1.50 +++ src/usr.bin/sndiod/dev.c 2019/07/10 14:24:42 1.51 @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.c,v 1.50 2019/07/10 14:22:52 ratchov Exp $ */ +/* $OpenBSD: dev.c,v 1.51 2019/07/10 14:24:42 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * @@ -1598,28 +1598,29 @@ bestidx = i; } } - if (bestidx == DEV_NSLOT) { - if (log_level >= 1) { + if (bestidx != DEV_NSLOT) { + s = d->slot + bestidx; + s->vol = MIDI_MAXCTL; + strlcpy(s->name, name, SLOT_NAMEMAX); + s->serial = d->serial++; + s->unit = unit; +#ifdef DEBUG + if (log_level >= 3) { log_puts(name); log_putu(unit); - log_puts(": out of sub-device slots\n"); + log_puts(": overwritten slot "); + log_putu(bestidx); + log_puts("\n"); } - return NULL; +#endif + goto found; } - s = d->slot + bestidx; - s->vol = MIDI_MAXCTL; - strlcpy(s->name, name, SLOT_NAMEMAX); - s->serial = d->serial++; - s->unit = unit; -#ifdef DEBUG - if (log_level >= 3) { + if (log_level >= 1) { log_puts(name); log_putu(unit); - log_puts(": overwritten slot "); - log_putu(bestidx); - log_puts("\n"); + log_puts(": out of sub-device slots\n"); } -#endif + return NULL; found: if ((mode & MODE_REC) && (opt->mode & MODE_MON)) {