=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndiod/midi.c,v retrieving revision 1.21 retrieving revision 1.22 diff -c -r1.21 -r1.22 *** src/usr.bin/sndiod/midi.c 2019/08/29 07:19:15 1.21 --- src/usr.bin/sndiod/midi.c 2019/09/21 04:42:46 1.22 *************** *** 1,4 **** ! /* $OpenBSD: midi.c,v 1.21 2019/08/29 07:19:15 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * --- 1,4 ---- ! /* $OpenBSD: midi.c,v 1.22 2019/09/21 04:42:46 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * *************** *** 438,444 **** struct port *c; c = xmalloc(sizeof(struct port)); ! c->path = xstrdup(path); c->state = PORT_CFG; c->hold = hold; c->midi = midi_new(&port_midiops, c, mode); --- 438,445 ---- struct port *c; c = xmalloc(sizeof(struct port)); ! c->path_list = NULL; ! namelist_add(&c->path_list, path); c->state = PORT_CFG; c->hold = hold; c->midi = midi_new(&port_midiops, c, mode); *************** *** 468,474 **** #endif } *p = c->next; ! xfree(c->path); xfree(c); } --- 469,475 ---- #endif } *p = c->next; ! namelist_clear(&c->path_list); xfree(c); } *************** *** 592,595 **** --- 593,608 ---- { if (c->state == PORT_INIT) port_drain(c); + } + + int + port_reopen(struct port *p) + { + if (p->state == PORT_CFG) + return 1; + + if (!port_mio_reopen(p)) + return 0; + + return 1; }