On Sat, Dec 09, 2023 at 10:16:46PM +0100, Alexandre Ratchov wrote:
> On Sat, Dec 09, 2023 at 03:45:44PM +0000, Klemens Nanni wrote:
> >
> > However, detach USB during explicit playback to it, e.g.
> > $ AUDIODEVICE=snd/1 ncspot
> > crashes sndiod(8) rather than playback just stopping instead of switching.
> >
> > Using USB alone ('sndiod -f snd/1') and device defaults ('ncspot') does not
> > crash when unplugging during playback.
>
> [...]
>
> > #2 0x000005340e83dbce in panic () at /s/usr.bin/sndiod/utils.c:138
> > #3 0x000005340e839308 in sock_close (f=0x5340e842720 <slot_array>) at
> > /s/usr.bin/sndiod/sock.c:183
>
> sock_close() is called with the wrong argument. Thank you for the trace.
> ok?
Fixes the reproducer, OK kn
>
> Index: dev.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/sndiod/dev.c,v
> diff -u -p -r1.106 dev.c
> --- dev.c 26 Dec 2022 19:16:03 -0000 1.106
> +++ dev.c 9 Dec 2023 21:12:21 -0000
> @@ -1389,7 +1389,7 @@ dev_migrate(struct dev *odev)
> if (s->opt == NULL || s->opt->dev != odev)
> continue;
> if (s->ops != NULL) {
> - s->ops->exit(s);
> + s->ops->exit(s->arg);
> s->ops = NULL;
> }
> }
>