From aeb045601f6dde93b908f55eeaec9fe46470bbfa Mon Sep 17 00:00:00 2001 From: ratchov Date: Wed, 20 May 2026 13:26:57 +0000 Subject: [PATCH] sndiod: When connecting midi endpoints, check their modes As sndiod always uses IN|OUT, the behavior is unchanged. --- usr.bin/sndiod/midi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/sndiod/midi.c b/usr.bin/sndiod/midi.c index 6d6d4001c95..40878123d4d 100644 --- a/usr.bin/sndiod/midi.c +++ b/usr.bin/sndiod/midi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midi.c,v 1.34 2026/05/20 13:26:02 ratchov Exp $ */ +/* $OpenBSD: midi.c,v 1.35 2026/05/20 13:26:57 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * @@ -147,11 +147,11 @@ midi_del(struct midi *ep) void midi_link(struct midi *ep, struct midi *peer) { - if (ep->mode & MODE_MIDIOUT) { + if ((ep->mode & MODE_MIDIOUT) && (peer->mode & MODE_MIDIIN)) { ep->txmask |= peer->self; midi_tickets(ep); } - if (ep->mode & MODE_MIDIIN) { + if ((ep->mode & MODE_MIDIIN) && (peer->mode & MODE_MIDIOUT)) { #ifdef DEBUG if (ep->obuf.used > 0) { logx(0, "midi%u: linked with non-empty buffer", ep->num);