From 792569533f15de8006b365b67d4ab085eed12d7d Mon Sep 17 00:00:00 2001 From: ratchov Date: Sun, 7 Nov 2021 20:51:47 +0000 Subject: [PATCH] Allow -current libsndio to connect to old sndiod servers Recent sndio device naming change is missing the proper compatibility bits for this case. Found and fixed by bluhm@ and tweaks from me. ok bluhm --- lib/libsndio/aucat.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c index 6d7a15419a2..1e48786e709 100644 --- a/lib/libsndio/aucat.c +++ b/lib/libsndio/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.78 2021/11/01 14:43:24 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.79 2021/11/07 20:51:47 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -444,10 +444,22 @@ _aucat_open(struct aucat *hdl, const char *str, unsigned int mode) } p++; if (type == 0) { - devnum = AMSG_NODEV; - p = parsestr(p, opt, AMSG_OPTMAX); - if (p == NULL) - return 0; + if (*p < '0' || *p > '9') { + devnum = AMSG_NODEV; + p = parsestr(p, opt, AMSG_OPTMAX); + if (p == NULL) + return 0; + } else { + p = _sndio_parsenum(p, &devnum, 15); + if (p == NULL) + return 0; + if (*p == '.') { + p = parsestr(++p, opt, AMSG_OPTMAX); + if (p == NULL) + return 0; + } else + strlcpy(opt, "default", AMSG_OPTMAX); + } } else { p = _sndio_parsenum(p, &devnum, 15); if (p == NULL) -- 2.20.1